私は単純なタスクプランナーを構築しています。これは、TaskController.phpファイルからのフラグメントです。どのように私はこれら3つのクエリ(完了していない、完了した)を組み合わせて動作させることができますか?私はDQLを使うべきですか?symfony2 3つのクエリを組み合わせた教義
/**
* Lists all task entities.
*
* @Route("/", name="task_index")
* @Method("GET")
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$tasks = $em->getRepository('TaskBundle:Task')->findByUser($this->getUser()); // all tasks of a specific user
$notcompleted = $em->getRepository('TaskBundle:Task')->findByCompleted(false); //tasks that are not completed
$completed = $em->getRepository('TaskBundle:Task')->findByCompleted(true); // all completed tasks
return $this->render('task/index.html.twig', array(
'notcompleted' => $notcompleted,
'completed' => $completed,
'tasks' => $tasks,
));
}
私がログインしているユーザーのすべて完了したタスクを表示したいし、次にログインしたユーザーのタスクを完了していません。 – Blazej