本文整理汇总了PHP中Oro\Bundle\EntityBundle\ORM\DoctrineHelper::getEntityIdentifier方法的典型用法代码示例。如果您正苦于以下问题:PHP DoctrineHelper::getEntityIdentifier方法的具体用法?PHP DoctrineHelper::getEntityIdentifier怎么用?PHP DoctrineHelper::getEntityIdentifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oro\Bundle\EntityBundle\ORM\DoctrineHelper
的用法示例。
在下文中一共展示了DoctrineHelper::getEntityIdentifier方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetEntityIdentifierNotManageableEntity
public function testGetEntityIdentifierNotManageableEntity()
{
$entity = $this->getMock('FooEntity');
$this->setExpectedException('Oro\\Bundle\\EntityBundle\\Exception\\NotManageableEntityException', sprintf('Entity class "%s" is not manageable', get_class($entity)));
$this->registry->expects($this->once())->method('getManagerForClass')->with(get_class($entity))->will($this->returnValue(null));
$this->doctrineHelper->getEntityIdentifier($entity);
}
示例2: normalize
/**
* {@inheritdoc}
*/
public function normalize(Workflow $workflow, Attribute $attribute, $attributeValue)
{
if (null === $attributeValue) {
return null;
}
$this->validateAttributeValue($workflow, $attribute, $attributeValue);
$identifier = $this->doctrineHelper->getEntityIdentifier($attributeValue);
return $identifier ?: null;
}
示例3: normalize
/**
* {@inheritdoc}
*/
public function normalize(Workflow $workflow, Attribute $attribute, $attributeValue)
{
if (null === $attributeValue) {
return null;
}
$this->validateAttributeValue($workflow, $attribute, $attributeValue);
$result = [];
foreach ($attributeValue as $value) {
$result[] = $this->doctrineHelper->getEntityIdentifier($value);
}
return $result;
}
示例4: doCompare
/**
* Compare two values for equality
*
* @param mixed $left
* @param mixed $right
* @return boolean
*/
protected function doCompare($left, $right)
{
if (is_object($left) && is_object($right)) {
$leftClass = $this->doctrineHelper->getEntityClass($left);
$rightClass = $this->doctrineHelper->getEntityClass($right);
if ($leftClass == $rightClass && $this->doctrineHelper->isManageableEntity($left) && $this->doctrineHelper->isManageableEntity($right)) {
$leftIdentifier = $this->doctrineHelper->getEntityIdentifier($left);
$rightIdentifier = $this->doctrineHelper->getEntityIdentifier($right);
return $leftIdentifier == $rightIdentifier;
}
}
return $left == $right;
}
示例5: convertToPlainArray
/**
* @param array|\Traversable $values
* @return array
*/
protected function convertToPlainArray($values)
{
$result = array();
foreach ($values as $key => $value) {
if (is_object($value) && $this->doctrineHelper->isManageableEntity($value)) {
$result[$key] = $this->doctrineHelper->getEntityIdentifier($value);
} elseif (is_array($value) || $value instanceof \Traversable) {
$result[$key] = $this->convertToPlainArray($value);
} else {
$result[$key] = $value;
}
}
return $result;
}
示例6: reloadEntity
/**
* @param object $entity
* @return Integration
*/
protected function reloadEntity($entity)
{
return $this->doctrineHelper->getEntity($this->doctrineHelper->getEntityClass($entity), $this->doctrineHelper->getEntityIdentifier($entity));
}