<?php

namespace AppBundle\Repository;

use Doctrine\ORM\EntityRepository;

/**
 * TaskListsRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class TaskListsRepository extends EntityRepository
{

  public function findAll()
  {
    $today = new \DateTime();
    return $this
            ->createQueryBuilder('tl')
            ->select('tl, t')
            ->leftJoin('tl.tasks', 't')
            ->orderBy("tl.createdAt", "ASC")
            ->getQuery()
            ->getResult();
  }

  public function findAllWithActiveTasks()
  {
    $today = new \DateTime();
    return $this
            ->createQueryBuilder('tl')
            ->select('tl, t')
            ->leftJoin('tl.tasks', 't')
            ->where('t.completedAt > :today')
            ->orWhere('t.completed <> true')
            ->addOrderBy("t.completed", "ASC")
            ->addOrderBy("t.order", "ASC")
            ->setParameter(':today', $today->format('Y-m-d'))
            ->getQuery()
            ->getResult();
  }

  public function search($searchTerm)
  {
    return $this
            ->createQueryBuilder('tl')
            ->select()
            ->where('tl.name LIKE :searchTerm')
            ->setParameter(":searchTerm", '%' . $searchTerm . '%')
            ->getQuery()
            ->getResult();
  }

}

<?php

namespace AppBundle\Repository;

use Doctrine\ORM\EntityRepository;

/**
 * TaskListsRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class TaskListsRepository extends EntityRepository
{

  public function findAll()
  {
    $today = new \DateTime();
    return $this
            ->createQueryBuilder('tl')
            ->select('tl, t, a, c, w')
            ->leftJoin('tl.tasks', 't')
            ->leftJoin('tl.account', 'a')
            ->leftJoin('a.client', 'c')
            ->leftJoin('t.workLog', 'w')
            ->orderBy("tl.createdAt", "ASC")
            ->getQuery()
            ->getResult();
  }

  public function findAllWithActiveTasks()
  {
    $today = new \DateTime();
    return $this
            ->createQueryBuilder('tl')
            ->select('tl, t')
            ->leftJoin('tl.tasks', 't')
            ->where('t.completedAt > :today')
            ->orWhere('t.completed <> true')
            ->addOrderBy("t.completed", "ASC")
            ->addOrderBy("t.order", "ASC")
            ->setParameter(':today', $today->format('Y-m-d'))
            ->getQuery()
            ->getResult();
  }

  public function search($searchTerm)
  {
    return $this
            ->createQueryBuilder('tl')
            ->select()
            ->where('tl.name LIKE :searchTerm')
            ->setParameter(":searchTerm", '%' . $searchTerm . '%')
            ->getQuery()
            ->getResult();
  }

}

Increase taskList performance by reducing queries
Increase taskList performance by reducing queries