/**
* Returns the identifier assigned to the given entity.
*
* @param object $xmlEntity
* @return mixed
* @override
*/
public function generate(XmlEntityManager $xem, $xmlEntity)
{
$class = $xem->getClassMetadata(get_class($xmlEntity));
$idField = $class->identifier;
$value = $class->reflFields[$idField]->getValue($xmlEntity);
if (isset($value)) {
if (is_object($value)) {
// NOTE: Single Columns as associated identifiers only allowed - this constraint it is enforced.
$identifier = current($xem->getUnitOfWork()->getEntityIdentifier($value));
} else {
$identifier = $value;
}
} else {
throw OXMException::entityMissingAssignedId($xmlEntity);
}
return $identifier;
}