/**
* Load entities specified by a request instance.
*
* @param Object\IRequest $Request The request to load
* @return object|null|array
* @throws Object\TypeMismatchException
*/
public function LoadRequest(Object\IRequest $Request)
{
if ($Request->GetEntityType() !== $this->EntityType) {
throw new Object\TypeMismatchException('The supplied request is of type %s, expecting: %s', $Request->GetEntityType(), $this->EntityType);
}
$Entities = $this->DomainDatabaseMap->Load($Request);
if (is_array($Entities)) {
$this->IdentityMap->CacheEntities($Entities);
} else {
if ($Entities instanceof $this->EntityType) {
$this->IdentityMap->CacheEntity($Entities);
}
}
return $Entities;
}