public function getQueryBuilderFromRequest(Request $request)
    {
        $qb = $this->createValuedQueryBuilder('c');

        if ($request->get('q')) {
            $qb->leftJoin('c.template', 't');
            $qb->andWhere('c.title LIKE :query OR c.alias LIKE :query OR c.slug LIKE :query OR t.displayName LIKE :query')->setParameter('query', '%' . $request->get('q') . '%');
        } else {
            //if ($request->get('directory_id')) {
            //    $qb->andWhere('c.directory = :directory')->setParameter('directory', $request->get('directory_id'));
            //} else {
            //    $qb->andWhere('c.directory is NULL');
            //}
        }

        if ($ids = $request->get('ids')) {
            $ids = explode(',', $ids);

            $qb->andWhere('c.id IN (:ids)')->setParameter('ids', $ids);
        }

        $qb->andWhere('c.deletedAt IS NULL');  // @TODO fix SoftDeleteAble filter

        $qb->orderBy('c.slug');

        return $qb;
    }