/**
  * @return void
  * @throws \TYPO3\Flow\Security\Exception\AuthenticationRequiredException
  */
 public function initializeAction()
 {
     $this->authenticationManager->authenticate();
     if ($this->session->getLocation() == null && $this->request->getControllerName() != 'Login' && !$this->authenticationManager->getSecurityContext()->hasRole('DLigo.Animaltool:Admin') && $this->request->getControllerActionName() != 'select' && $this->request->getControllerName() != 'Location') {
         $this->redirect('select', 'location');
     }
     if ($this->request->hasArgument('cancel')) {
         if (!($this->request->getControllerActionName() == 'merge' && $this->request->getControllerName() == 'Animal')) {
             $this->redirect('index', 'animal');
         }
     }
     $msgs = $this->flashMessageContainer->getMessagesAndFlush();
     foreach ($msgs as $msg) {
         if ($msg->getSeverity() == 'Error' && $msg->getTitle() == '' && $msg->getCode() === null) {
             continue;
         }
         $this->flashMessageContainer->addMessage($msg);
     }
     if (isset($this->arguments['animal'])) {
         $this->arguments['animal']->getPropertyMappingConfiguration()->forProperty('birthday')->setTypeConverterOption('TYPO3\\Flow\\Property\\TypeConverter\\DateTimeConverter', \TYPO3\Flow\Property\TypeConverter\DateTimeConverter::CONFIGURATION_DATE_FORMAT, 'Y-m-d');
     }
     if (isset($this->arguments['newAnimal'])) {
         $this->arguments['newAnimal']->getPropertyMappingConfiguration()->forProperty('birthday')->setTypeConverterOption('TYPO3\\Flow\\Property\\TypeConverter\\DateTimeConverter', \TYPO3\Flow\Property\TypeConverter\DateTimeConverter::CONFIGURATION_DATE_FORMAT, 'Y-m-d');
     }
 }
예제 #2
0
 /**
  *
  * @return void
  */
 public function logoutAction()
 {
     $this->authenticationManager->logout();
     $this->session->clear();
     $this->addFlashMessage('Successfully logged out.', '', \TYPO3\Flow\Error\Message::SEVERITY_OK, array(), 'flash.logout');
     $this->redirect('index', 'Login');
 }
예제 #3
0
 public function onFlush(OnFlushEventArgs $args)
 {
     if (PHP_SAPI === 'cli') {
         return;
     }
     $this->em = $args->getEntityManager();
     $eventManager = $this->em->getEventManager();
     $eventManager->removeEventListener('onFlush', $this);
     $this->uow = $this->em->getUnitOfWork();
     $histories = new \Doctrine\Common\Collections\ArrayCollection();
     $this->hmeta = $this->em->getClassMetadata('DLigo\\Animaltool\\Domain\\Model\\HistoryChange');
     $user = $this->session->getUser();
     $this->userId = $this->persistenceManager->getIdentifierByObject($user);
     $this->userLabel = $user->__toString();
     foreach ($this->uow->getScheduledEntityInsertions() as $entity) {
         $meta = $this->em->getClassMetadata(get_class($entity));
         $this->putAnimal($entity, $meta);
         $history = array('entity' => $entity, 'changes' => $this->uow->getEntityChangeSet($entity), 'meta' => $meta, 'type' => 'INSERT');
         $histories->add($history);
         $this->em->getUnitOfWork()->recomputeSingleEntityChangeSet($meta, $entity);
     }
     foreach ($this->uow->getScheduledEntityDeletions() as $entity) {
         $meta = $this->em->getClassMetadata(get_class($entity));
         $this->putAnimal($entity, $meta);
         $history = array('entity' => $entity, 'changes' => null, 'meta' => $meta, 'type' => 'DELETE');
         $histories->add($history);
     }
     foreach ($this->uow->getScheduledEntityUpdates() as $key => $entity) {
         $meta = $this->em->getClassMetadata(get_class($entity));
         $this->putAnimal($entity, $meta);
         $history = array('entity' => $entity, 'changes' => $this->uow->getEntityChangeSet($entity), 'meta' => $meta, 'type' => 'UPDATE');
         $histories->add($history);
         $this->uow->computeChangeSet($meta, $entity);
     }
     foreach ($histories as $h) {
         $this->processHistory($h);
     }
     $eventManager->addEventListener('onFlush', $this);
 }