Пример #1
0
 /**
  * Obdela spremembe polj entitet
  */
 protected function processEntities()
 {
     foreach ($this->entities as $entity) {
         $this->checkBaseEntity($entity);
         if ($this->uow->isScheduledForInsert($entity)) {
             // INSERT - ni sprememb
             $this->addChanges($entity, 'INS');
         } elseif ($this->uow->isScheduledForUpdate($entity)) {
             // UPDATE - shrani samo spremembe
             $class = get_class($entity);
             $changes = $this->getEntityChanges($entity);
             foreach ($changes as $field => $change) {
                 if ($this->isFieldTracked($class, $field)) {
                     $this->addChanges($entity, 'UPD', [$field => $change]);
                 }
             }
         } elseif ($this->uow->isScheduledForDelete($entity)) {
             // DELETE - shrani zadnje stanje entitete
             $data = $this->getEntityData($entity);
             $this->addChanges($entity, 'DEL', $data);
         }
     }
 }
Пример #2
0
 /**
  * Determines whether an entity instance is managed in this EntityManager.
  *
  * @param object $entity
  * @return boolean TRUE if this EntityManager currently manages the given entity, FALSE otherwise.
  */
 public function contains($entity)
 {
     return $this->_unitOfWork->isScheduledForInsert($entity) || $this->_unitOfWork->isInIdentityMap($entity) && !$this->_unitOfWork->isScheduledForDelete($entity);
 }