示例#1
0
 public function actionsAction($goal_id)
 {
     $em = $this->getDoctrine()->getManager();
     $goal = $em->getRepository('AcmeEdelaBundle:Goal')->find($goal_id);
     if (!$goal || $goal->getUser() != $this->container->get('security.context')->getToken()->getUser()) {
         throw $this->createNotFoundException('goal.not_found');
     }
     $tasks = $goal->getTasks()->matching(Criteria::create()->where(Criteria::expr()->orX(Criteria::expr()->eq('dateAt', new \DateTime('today midnight')), Criteria::expr()->isNull('dateAt')))->andWhere(Criteria::expr()->isNull('parent')));
     $task = new Task();
     $task->setGoal($goal);
     $addTaskForm = $this->createForm(new TaskCreateShortFormType(), $task, array('action' => $this->generateUrl('tasks_create_short'), 'em' => $em));
     return $this->render('AcmeEdelaBundle:Actions:list.html.twig', array('goal' => $goal, 'addTaskForm' => $addTaskForm->createView(), 'tasks' => $tasks));
 }