Good day. I have a base entity - Place and its 2 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; } As you can see, it can contain both InPlace and OutPlace , which is why I bind with the base Place class
Actually the question is - do I sample from the database, for example, like this ( Geo repository)
$qb = $em->createQueryBuilder('geo'); $qb ->select('geo') ->leftJoin('geo.place', 'place') // поля photo есть только в дочерних классах. В Place их нет ->leftJoin('place.photo', 'photo') ; and I get the corresponding error that Place has no photo field (it’s correct, because photo is only in the child classes).
How can I make it so that when a sample is picked up, it’s not a base class, but a child class that is tied to this Geo ?
Coped in the direction of resolve_target_entity , but there the binding goes of one class to one