i have relationships (ManyToMany) in symfony2:
Item <-> Category
Database:
Item: ID NAME
Category ID NAME SLUG
Item Category: id item_id category_id
I'm trying to find all the items that are connected with the categories by x slugs.
code does not work:
$qb = $this->createQueryBuilder('i')
->select('i, c ')
->leftJoin('i.categories', 'c')
->setParameter('firstSlug', 'first')
->andWhere('c.slug = :firstSlug')
->setParameter('secondSlug', 'second')
->andWhere('c.slug = :secondSlug')
Any ideas how to do it?
setParameterneeds to come after theandWhereclauses - Adam Elsodaney