Ejemplo n.º 1
0
 public function add($entityCode, $entityType, $entityId = '', $log = '')
 {
     $history = new History();
     $history->setCreatedAt(new \DateTime());
     $history->setCreatedBy($this->tokenStorage->getToken()->getUser()->getId());
     $history->setEntityCode($entityCode);
     $history->setType($entityType);
     $history->setEntityId($entityId);
     $history->setLog($log);
     $this->em->persist($history);
     $this->em->flush();
 }
Ejemplo n.º 2
0
 public function preRemove(LifecycleEventArgs $args)
 {
     $entity = $args->getEntity();
     if ($this->skipCondition($entity)) {
         $className = strtolower($this->extractClass($entity));
         if ($this->skipCondition($entity)) {
             $history = new History();
             $history->setCreatedAt(new \DateTime());
             $history->setUser($this->container->get('security.token_storage')->getToken()->getUser());
             $history->setEntityCode($className);
             $history->setType('deleted');
             $history->setEntryId($entity->getId());
             $history->setLog('Entity deleted');
             $this->history[] = $history;
         }
     }
 }