Reputation: 1706
I've got 2 entity with Many To Many Relationship. They are Mapped correctly, both sides.
When I'm querying the inverse side with an Entity of the Owning side I've got the following error:
ContextErrorException: Notice: Undefined index: joinColumns in /var/www/symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php line 1528
I'm using the "built-in" doctrine findBy Methods, in this case: "findByInverseSide($InverseSideEntity)"
Upvotes: 1
Views: 543
Reputation: 1706
I solve this By creating a DQL query with Left Join on the InverseSide of The Table:
EX:
...
$qb = $this->createQueryBuilder('q');
$qb->leftJoin('q.inverseSide', 'i')
->where('i.id = :inverseSide_id')
->setParameter('inverseSide_id', $inverseSide_id);
...
Upvotes: 1