public function testEmptyCategoryIdisNull() { $category = new Category(); $this->assertNull($category->getId()); }
/** * Get query for select projects by category * * @param Category $category * @param string $orderBy * @param string $orderDirection * * @return Query */ public function getQueryForSelectProjectsByCategory(Category $category, $orderBy = 'p.date', $orderDirection = 'DESC') { $qb = $this->getQueryBuilderWithOrdering($orderBy, $orderDirection); return $qb->join('p.categories', 'c')->andWhere('c.id = :category')->setParameter('category', $category->getId())->getQuery(); }