Exemplo n.º 1
0
 /**
  * Event automatically fired when user is registered
  *
  * @param FilterUserResponseEvent $event
  */
 public function onUserRegistered(FilterUserResponseEvent $event)
 {
     /** @var User $user */
     $user = $event->getUser();
     $name = 'Unasigned actions';
     $task = new Task($name, $user);
     $task->setDefault(true);
     $this->taskRepository->save($task);
 }
Exemplo n.º 2
0
 /**
  * Sets task as users default task
  *
  * @param Task $task
  * @param User $user
  */
 public function setTaskAsDefault(Task $task, User $user)
 {
     $this->em->beginTransaction();
     $defaultTask = $this->taskRepository->findUserDefaultTask($user->getId());
     $defaultTask->setDefault(false);
     $task->setDefault(true);
     $this->taskRepository->update($task);
     $this->em->flush();
     $this->em->commit();
 }