/** * {@inheritDoc} */ public final function MapPrimaryKeysToIdentities(array $PrimaryKeys) { $Identities = array_map(function () { return $this->EntityMap->Identity(); }, $PrimaryKeys); foreach ($this->IdentityPropertyPrimaryKeyMappings as $Mapping) { $Mapping->Revive($PrimaryKeys, $Identities); } return $Identities; }
/** * Loads an entity from given identity values or null if entity does not exist. * * @param mixed ... The identity value(s) * @return object|null The returned entity or null * @throws \Storm\Core\StormException */ public function LoadById($_) { $IdentityValues = func_get_args(); if (count($IdentityValues) !== count($this->IdentityProperties)) { throw new \Storm\Core\StormException('The supplied amount of parameters does not match the number of ' . 'identity properties for %s, expecting %d: %d were supplied', $this->EntityType, count($this->IdentityProperties), count($IdentityValues)); } $Identity = $this->EntityMap->Identity(); $Count = 0; foreach ($this->IdentityProperties as $IdentityProperty) { $Identity[$IdentityProperty] = $IdentityValues[$Count]; $Count++; } return $this->LoadByIdentity($Identity); }
public final function CacheEntity($Entity, Object\Identity $Identity = null) { $Identity = $Identity ?: $this->EntityMap->Identity($Entity); $IdentityHash = $Identity->Hash(); $this->Cache->Save($IdentityHash, $Entity); }