public function addToIdentityMap($xmlEntity)
{
$classMetadata = $this->xem->getClassMetadata(get_class($xmlEntity));
$id = $this->entityIdentifiers[spl_object_hash($xmlEntity)];
if ($id === '') {
throw new \InvalidArgumentException("The given xml entity has no identity.");
}
$className = $classMetadata->rootXmlEntityName;
if (isset($this->identityMap[$className][$id])) {
return false;
}
$this->identityMap[$className][$id] = $xmlEntity;
if ($xmlEntity instanceof NotifyPropertyChanged) {
$xmlEntity->addPropertyChangedListener($this);
}
return true;
}