I used ZF2, Doctrine
I have several Entity which extends base abstract class. One of fields in abstract class have relation with other Entity - message My Entity:
class AbstractChat
{
............
/** ONE-TO-MANY BIDIRECTIONAL, INVERSE SIDE
* @ORM\OneToMany(targetEntity="Chat\Entity\Message", mappedBy="chat")
*/
protected $messages;
}
class Chat extends AbstractChat
{
}
class ChatBuilding extends AbstractChat
{
}
class Message
{
/**
* @var \Chat\Entity\Chat
*
* @ORM\ManyToOne(targetEntity="Chat\Entity\AbstractChat", inversedBy="messages")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="chat_id", referencedColumnName="id")
* })
*/
private $chat;
}
How can I state that the relation is with all entities which extend AbstractChat
class?
This mean does not work:
@ORM\ManyToOne(targetEntity="Chat\Entity\AbstractChat", inversedBy="messages")