本文整理汇总了PHP中AbstractEntity类的典型用法代码示例。如果您正苦于以下问题:PHP AbstractEntity类的具体用法?PHP AbstractEntity怎么用?PHP AbstractEntity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AbstractEntity类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: save
public function save(AbstractEntity $entity)
{
if ($entity->getStorageStructure() == AbstractEntity::DOCUMENT) {
$dm = new DocumentManager();
$document = $entity->toDocument();
$dm->persist($document);
}
if ($entity->getStorageStructure() == AbstractEntity::RELATIONAL) {
$rm = new RecordManager();
$record = $entity->toRecord();
$rm->save($record);
}
}
开发者ID:pelif,项目名称:curso-design-pattern,代码行数:13,代码来源:PersistenceManager.php
示例2: testConvertFieldName
public function testConvertFieldName()
{
$fieldName = "intro_attended";
$this->assertEquals('getIntroAttended', AbstractEntity::convertFieldNameToGetterFunctionName($fieldName));
$fieldName = "status";
$this->assertEquals('getStatus', AbstractEntity::convertFieldNameToGetterFunctionName($fieldName));
$fieldName = "start_date_time";
$this->assertEquals('getStartDateTime', AbstractEntity::convertFieldNameToGetterFunctionName($fieldName));
}
开发者ID:Endymion1977,项目名称:phonebook,代码行数:9,代码来源:AbstractEntityTest.php
示例3: generateEntityMethods
/**
* @param AbstractEntity $entity
* @param string $indention
* @return string
*/
private function generateEntityMethods(AbstractEntity $entity, $indention)
{
$methodName = lcfirst($entity->methodNamePrefix() . ucfirst($entity->className()));
$content = PHP_EOL . $indention . '/**' . PHP_EOL . $indention . ' * @return ' . $entity->className() . PHP_EOL . $indention . ' */' . PHP_EOL . $indention . 'public function ' . $methodName . '()' . PHP_EOL . $indention . '{' . PHP_EOL;
if ($entity instanceof ObjectEntity) {
$content .= $indention . $indention . 'return new ' . $entity->className() . '();' . PHP_EOL;
} else {
if ($entity instanceof QueryEntity) {
$content .= $indention . $indention . 'return ' . $entity->className() . '::create();' . PHP_EOL;
}
}
$content .= $indention . '}' . PHP_EOL;
return $content;
}
开发者ID:bazzline,项目名称:php_propel_behavior_entity_instantiator,代码行数:19,代码来源:FileContentGenerator.php
示例4: setEntityMeta
/**
* Adds meta data to the actual entity object.
*
* @param AbstractEntity $entity
* @param mixed $resultRecord
*/
protected static function setEntityMeta(AbstractEntity $entity, $resultRecord)
{
if ($entity instanceof AbstractLocaleEntity) {
$entity->addMeta($resultRecord->key, $resultRecord->value, $resultRecord->locale);
}
}
开发者ID:Mendim,项目名称:ep3-bs,代码行数:12,代码来源:AbstractLocaleEntityFactory.php
示例5: array
$container = $is_modal ? 'admin_container' : 'our_content';
$before = 'toc';
$args = array('id' => $proposal_id, 'before' => $before, 'target' => $container, 'replace_target' => true);
$proposal_nr = Proposal::getInstance()->getProposalById($proposal_id);
if (!$proposal_nr) {
jsonBadResult(t('This proposal was already deleted!'), $args);
return;
}
$title = altPropertyValue($proposal_nr, 'title');
$state = altPropertyValue($proposal_nr, 'state');
if (!Groups::isOwner(_PROPOSAL_OBJ, $proposal_id)) {
jsonBadResult(t('You can only delete your own proposals!'), $args);
} elseif ($state == 'published') {
jsonBadResult(t('We could not remove your proposal: It has already been published.'), $args);
} else {
$num_deleted = db_delete(tableName(_PROPOSAL_OBJ))->condition(AbstractEntity::keyField(_PROPOSAL_OBJ), $proposal_id)->execute();
if ($num_deleted) {
// junk the proposal comments too
ThreadedComments::getInstance()->removethreadsForEntity($proposal_id, _PROPOSAL_OBJ);
$args['before'] = '';
jsonGoodResult(TRUE, tt('You have removed the proposal %1$s', $title), $args);
} else {
jsonBadResult(t('We could not remove your proposal'), $args);
}
}
} else {
jsonBadResult(t('No proposal identifier submitted!'), $args);
}
break;
case 'save_public':
// no break so that the request filters down to 'save'
开发者ID:edwinraycom,项目名称:vals-soc,代码行数:31,代码来源:proposal_actions.php
示例6: isMorhing
/**
* Returns true if value can be converted into domain model instance
* @param AbstractEntity $entity
* @param stdClass $value
* @return boolean
*/
private function isMorhing($entity, $value)
{
if (!$entity instanceof Serialization\ObjectEntity) {
return false;
}
//String, numeric are fine
if (!is_object($value)) {
return false;
}
// if object has same type already (it's wierd, but ok)
if (get_class($value) === $entity->getType()) {
return false;
}
// we expect stdClass here only
if (!$value instanceof \stdClass) {
return false;
}
return true;
}
开发者ID:andrewhook,项目名称:oauth-php,代码行数:25,代码来源:DomainEntityBuilder.php
示例7: mapEntityFromArray
/**
* @param AbstractEntity $entity
* @param array $array
*/
protected function mapEntityFromArray(AbstractEntity $entity, array $array)
{
$entity->setPropertiesFromArray($array);
}
开发者ID:express-ru,项目名称:sdk,代码行数:8,代码来源:AbstractMapper.php
示例8: build
/**
* Build a new backup window instance
*
* @param \stdClass|array|null $parameters
*/
public function build($parameters)
{
if (is_null($parameters)) {
return;
}
parent::build($parameters);
}
开发者ID:fideloper,项目名称:DigitalOceanV2,代码行数:12,代码来源:NextBackupWindow.php
示例9: setBeanName
/**
* Sets the bean name.
*
* @param string $beanName
* @throws Exception\InvalidBeanException
*/
public function setBeanName($beanName)
{
if (null !== $this->entityBeanName && $beanName != $this->entityBeanName) {
throw new Exception\InvalidBeanException($beanName, $this->entityBeanName, $this);
}
parent::setBeanName($beanName);
}
开发者ID:ivan-novakov,项目名称:php-perun-api,代码行数:13,代码来源:GenericEntity.php
示例10: __construct
public function __construct()
{
parent::__construct();
$this->_name = '';
$this->_reportedBugs = new ArrayCollection();
$this->_assignedBugs = new ArrayCollection();
}
开发者ID:joefallon,项目名称:DoctrineAndPhinxSpike,代码行数:7,代码来源:User.php
示例11: __construct
public function __construct()
{
parent::__construct();
$this->_description = '';
$this->_status = '';
$this->_products = new ArrayCollection();
}
开发者ID:joefallon,项目名称:DoctrineAndPhinxSpike,代码行数:7,代码来源:Bug.php
示例12: getChangedProperties
/**
* @return array
* @throws \Exception
*/
public function getChangedProperties()
{
if (!$this->original) {
throw new \Exception('No original snapshot taken');
}
$diff = array_diff_assoc($this->getPropertiesAsArray(), $this->original->getPropertiesAsArray());
return $diff;
}
开发者ID:express-ru,项目名称:sdk,代码行数:12,代码来源:AbstractEntity.php
示例13: _createSourceAdapterMock
/**
* Create source adapter mock and set it into model object which tested in this class
*
* @param array $columns value which will be returned by method getColNames()
* @return \Magento\ImportExport\Model\Import\AbstractSource|\PHPUnit_Framework_MockObject_MockObject
*/
protected function _createSourceAdapterMock(array $columns)
{
/** @var $source \Magento\ImportExport\Model\Import\AbstractSource|\PHPUnit_Framework_MockObject_MockObject */
$source = $this->getMockForAbstractClass('Magento\\ImportExport\\Model\\Import\\AbstractSource', [], '', false, true, true, ['getColNames']);
$source->expects($this->any())->method('getColNames')->will($this->returnValue($columns));
$this->_model->setSource($source);
return $source;
}
开发者ID:,项目名称:,代码行数:14,代码来源:
示例14: __construct
public function __construct(array $data)
{
if (empty($data)) {
return;
}
$photoSizes = $this->initPhotoSizesFromData($data);
$this->setPhotoSizes($photoSizes);
parent::__construct($data);
}
开发者ID:rudestan,项目名称:teebot,代码行数:9,代码来源:PhotoSizeArray.php
示例15: build
/**
* @param array $parameters
*/
public function build(array $parameters)
{
parent::build($parameters);
foreach ($parameters as $property => $value) {
if ('region' === $property && is_object($value)) {
$this->region = new Region($value);
}
}
}
开发者ID:mix376,项目名称:DigitalOceanV2,代码行数:12,代码来源:Action.php
示例16: build
/**
* @param \stdClass|array $parameters
*/
public function build($parameters)
{
parent::build($parameters);
foreach ($parameters as $property => $value) {
if ('region' === $property) {
$this->region = new Region($value);
continue;
}
}
}
开发者ID:BAY-A,项目名称:Gravity-Forms-DigitalOcean,代码行数:13,代码来源:Action.php
示例17: build
/**
* @param array $parameters
*/
public function build(array $parameters)
{
parent::build($parameters);
foreach ($parameters as $property => $value) {
switch ($property) {
case 'region':
if (is_object($value)) {
$this->region = new Region($value);
}
unset($parameters[$property]);
break;
}
}
}
开发者ID:robertol,项目名称:DigitalOceanV2,代码行数:17,代码来源:Volume.php
示例18: __construct
public function __construct()
{
parent::__construct();
$this->roles = new ArrayCollection();
}
开发者ID:jwoods,项目名称:CE_27,代码行数:5,代码来源:User.php
示例19: __construct
public function __construct($gs)
{
parent::__construct();
$this->gString = $gs;
}
开发者ID:jwoods,项目名称:CE_27,代码行数:5,代码来源:Guid.php
示例20: updateStatus
public function updateStatus($status, $id)
{
if (in_array($status, array('in_progress', 'shipped', 'arrived'))) {
return parent::update(array('status' => $status), $id);
}
}
开发者ID:19eugen86,项目名称:schedro.extjs,代码行数:6,代码来源:productsMovement.entity.php
注:本文中的AbstractEntity类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论