本文整理汇总了PHP中AbstractEntity类的典型用法代码示例。如果您正苦于以下问题:PHP AbstractEntity类的具体用法?PHP AbstractEntity怎么用?PHP AbstractEntity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AbstractEntity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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));
}
示例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;
}
示例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);
}
}
示例5: build
/**
* Build a new backup window instance
*
* @param \stdClass|array|null $parameters
*/
public function build($parameters)
{
if (is_null($parameters)) {
return;
}
parent::build($parameters);
}
示例6: 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);
}
示例7: __construct
public function __construct()
{
parent::__construct();
$this->_name = '';
$this->_reportedBugs = new ArrayCollection();
$this->_assignedBugs = new ArrayCollection();
}
示例8: __construct
public function __construct()
{
parent::__construct();
$this->_description = '';
$this->_status = '';
$this->_products = new ArrayCollection();
}
示例9: 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;
}
示例10: _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;
}
示例11: __construct
public function __construct(array $data)
{
if (empty($data)) {
return;
}
$photoSizes = $this->initPhotoSizesFromData($data);
$this->setPhotoSizes($photoSizes);
parent::__construct($data);
}
示例12: 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);
}
}
}
示例13: 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;
}
}
}
示例14: 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;
}
}
}
示例15: __construct
public function __construct()
{
parent::__construct();
$this->roles = new ArrayCollection();
}