I'm trying to do:
class PrixRepository extends EntityRepository
{
public function findPrixLike($film)
{
$query = $this->createQueryBuilder('p')
->addSelect('s')
->from('MG\UserBundle\Entity\SocieteDiffuseur', 's')
->join('s.paysDiffs', 'pays')
->where(':filmId MEMBER OF p.films')
->andWhere('pays.id MEMBER OF p.pays')
->setParameter('filmId', $film)
->getQuery();
$result = $query->getResult();
return $result;
}
}
And I get this error:
[Semantical Error] line 0, col 156 near 'id MEMBER OF': Error: Invalid PathExpression. Must be a SingleValuedAssociationField.
You can find my entity's structure here: Notice: Undefined index: joinColumns doctrine 2 + symfony 2 I tried multiple queries, but I really don't know what I have to do.
Congratz to @olaurendeau. Like he said doctrine is expected an entity and not an id so the correct query is : (pays MEMBER OF and not pays.id...)
public function findPrixLike($film)
{
$query = $this->createQueryBuilder('p')
->addSelect('s')
->from('MG\UserBundle\Entity\SocieteDiffuseur', 's')
->join('s.paysDiffs', 'pays')
->where(':filmId MEMBER OF p.films')
->andWhere('pays MEMBER OF p.pays')
->setParameter('filmId', $film)
->getQuery();
$result = $query->getResult();
return $result;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With