Answer the question
In order to leave comments, you need to log in
What is the correct way to delete when unidirectional ManyToOne?
Hello everyone, there is the following case - there is a Media entity from the SonataMediaBundle and let's say a Foo entity that has an $image field and a ManyToOne relationship to Media. In order not to prescribe all the connections in the Media - the connection is unidirectional, only from the side of Foo.
/**
* @ORM\ManyToOne(targetEntity="App\Application\Sonata\MediaBundle\Entity\Media")
* @ORM\JoinColumn(name="image_id", referencedColumnName="id", nullable=true)
*/
private $image;
"Entity of type 'App\Application\Sonata\MediaBundle\Entity\Media' for IDs id(7) was not found", which is quite logical since the connection is unidirectional, and the removal is not on the part of the owner.
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