/**
* Loads an entity from an identity instance.
*
* @param Object\Identity $Identity The identity of the entity
* @return object|null
*/
protected function LoadByIdentity(Object\Identity $Identity)
{
$CachedEntity = $this->IdentityMap->GetFromCache($Identity);
if ($CachedEntity instanceof $this->EntityType) {
return $CachedEntity;
}
$Entity = $this->DomainDatabaseMap->Load(new Base\Object\Request($this->EntityType, $this->EntityMap->GetProperties(), true, new Base\Object\Criteria\MatchesCriterion($Identity)));
if ($Entity instanceof $this->EntityType) {
$this->IdentityMap->CacheEntity($Entity, $Identity);
}
return $Entity;
}