Ejemplo n.º 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);
         }
     }
 }