Answer the question
In order to leave comments, you need to log in
Symfony and Doctrine. How to connect 2 different child entities of the same class in a selection?
Good afternoon.
I have a base entity - Place and 2 of its children - InPlace and OutPlace
Accordingly , InPlace and OutPlace are inherited from Place .
There is also a geo object class - Geo
class Geo{
/**
* @ORM\ManyToOne(targetEntity="Base\Place", inversedBy="geo")
* @ORM\JoinColumn(name="place_id", referencedColumnName="geo_id", onDelete="CASCADE")
*/
protected $place;
}
$qb = $em->createQueryBuilder('geo');
$qb
->select('geo')
->leftJoin('geo.place', 'place')
// поля photo есть только в дочерних классах. В Place их нет
->leftJoin('place.photo', 'photo')
;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question