getPersistedId() public method

Returns persisted primary value.
public getPersistedId ( ) : mixed
return mixed
Exemplo n.º 1
0
 protected function createComponentForm() : Ytnuk\Orm\Form
 {
     $form = $this->form->create($this->entity);
     $form->onSuccess[] = function (Ytnuk\Orm\Form $form) {
         $presenter = $this->getPresenter();
         switch ($form->isSubmitted()) {
             case $form['action']['add']:
                 $presenter->redirect('Presenter:edit', $this->entity->getPersistedId());
                 break;
             case $form['action']['edit']:
                 $presenter->redirect('this#' . $this->getSnippetId());
                 break;
             case $form['action']['delete']:
                 $presenter->redirect('Presenter:list');
                 break;
         }
     };
     return $form;
 }
Exemplo n.º 2
0
 public function add(IEntity $entity)
 {
     $this->entities[implode(',', (array) $entity->getPersistedId())] = $entity;
 }
Exemplo n.º 3
0
 public function remove(IEntity $entity)
 {
     $this->beginTransaction();
     $primary = [];
     $id = (array) $entity->getPersistedId();
     foreach ($this->getStorageReflection()->getStoragePrimaryKey() as $key) {
         $primary[$key] = array_shift($id);
     }
     $this->processRemove($entity, $primary);
 }
Exemplo n.º 4
0
 public function remove(IEntity $entity)
 {
     $this->beginTransaction();
     $primary = [];
     $id = (array) $entity->getPersistedId();
     foreach ($this->getStorageReflection()->getStoragePrimaryKey() as $key) {
         $primary[$key] = array_shift($id);
     }
     $this->connection->query('DELETE FROM %table WHERE %and', $this->getTableName(), $primary);
 }
Exemplo n.º 5
0
 public function remove(IEntity $entity)
 {
     $this->initializeData();
     $id = implode(',', (array) $entity->getPersistedId());
     $this->data[$id] = null;
     $this->dataToStore[$id] = null;
 }
Exemplo n.º 6
0
 public function remove(IEntity $entity)
 {
     $this->beginTransaction();
     $id = (array) $entity->getPersistedId();
     $primary = [];
     foreach ($this->getStorageReflection()->getStoragePrimaryKey() as $key) {
         $primary[$key] = array_shift($id);
     }
     $this->databaseContext->query('DELETE FROM ' . $this->getTableName() . ' WHERE ?', $primary);
 }