Identity() публичный Метод

If the entity is null returns a new blank identity otherwise returns the identity of the supplied entity.
public Identity ( object | null $Entity = null ) : Identity
$Entity object | null
Результат Identity The entity's identity
Пример #1
0
 /**
  * {@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;
 }
Пример #2
0
 /**
  * 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);
 }
Пример #3
0
 public final function CacheEntity($Entity, Object\Identity $Identity = null)
 {
     $Identity = $Identity ?: $this->EntityMap->Identity($Entity);
     $IdentityHash = $Identity->Hash();
     $this->Cache->Save($IdentityHash, $Entity);
 }