Представьте себе следующие сущности Doctrine 2:
Код: Выделить всё
class ImageHistory
{
/**
* @var Image
*/
protected $current;
/**
* @var \Doctrine\Common\Collections\Collection
*/
protected $old;
}
class Dog
{
protected $name;
/**
* @var ImageHistory
*/
protected $imageHistory;
}
class Cat
{
protected $name;
/**
* @var ImageHistory
*/
protected $imageHistory;
}
Код: Выделить всё
manyToOne:
imageHistory:
targetEntity: ImageHistory
joinColumn:
name: image_history_id
referencedColumnName: id
Код: Выделить всё
oneToMany:
owner:
targetEntity:
mappedBy: imageHistory
Невозможно просто добавить SoundHistory как отношение oneToMany к классу Animal, поскольку Car и Boat не наследуются от него . Поэтому я все еще не могу заполнить targetEntity моего отношения OneToMany в сущности ImageHistory.
Как лучше всего спроектировать модель сущности в этом случае? ?
Подробнее здесь: https://stackoverflow.com/questions/172 ... -relations