Storm\Api\Base\Repository::Persist PHP Метод

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

If AutoSave is enabled, the action will be commited.
public Persist ( object $Entity ) : void
$Entity object The entity to persist
Результат void
    public function Persist($Entity)
    {
        $this->VerifyEntity(__METHOD__, $Entity);
        $this->IdentityMap->CacheEntity($Entity);
        $this->PersistedQueue[] = $Entity;
        $this->AutoSave();
    }

Usage Example

Пример #1
0
 private function PersistExisting($Id, Storm $BloggingStorm, Repository $BlogRepository, Repository $TagRepository)
 {
     $Blog = $BlogRepository->LoadById($Id);
     $Blog->Posts[0]->Content = 'foobar';
     $Blog->Posts[0]->Author->FirstName .= 'a';
     $Blog->Posts[1]->Content = 'BarBar---------------!';
     $BlogRepository->Persist($Blog);
     $BlogRepository->SaveChanges();
     return $Blog;
 }