I have a problem with a many to one relationship.
Here I have a Client entity that already exists. Then I try to link Documents to this entity.
I have a document creation form with a selector that lists my clients. There are no problems.
But when I try to record my dcoument I have the following message:
A new entity was found through the relationship 'App\Entity\Document#Client' that was not configured to cascade persist operations for entity: App\Entity\Client@000000006889f4d900000000795bd53c. To solve this issue: Either explicitly call EntityManager#persist() on this unknown entity or configure cascade persist this association in the mapping for example @ManyToOne(..,cascade={"persist"}). If you cannot find out which entity causes the problem implement 'App\Entity\Client#__toString()' to get a clue.
I do not understand why I must persit my client entity.
In my document entity I have this:
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Client", inversedBy="Documents")
* @ORM\JoinColumn(nullable=false)
*/
private $Client;
And in my Client entity I have this:
/**
* @ORM\OneToMany(targetEntity="App\Entity\Document", mappedBy="Client")
* @ORM\JoinColumn(nullable=false)
*/
private $Documents;
Do you have any idea about the nature of my problem?
Thank you in advance.