/** * @param Tag $tag * @param string $locale * * @return Query */ public function findPostsByTagAsQuery(Tag $tag, $locale) { $qb = $this->createQueryBuilder('p'); $qb->where($qb->expr()->eq('t.id', ':tag_id'))->andWhere($qb->expr()->eq('p.published', true))->leftJoin('p.tags', 't')->setParameter('tag_id', $tag->getId())->orderBy('p.created', 'DESC'); $this->addLocaleFilter($locale, $qb); return $qb->getQuery(); }
public function testEmptyTagIdIsNull() { $tag = new Tag(); $this->assertNull($tag->getId()); }