Reputation: 1223
When I create a User with FOSUserBundle UserManager and then I want to add it to different Entity like this:
$log = new Log();
$log->setOwner($user)
I get error that "A new entity was found through the relationship". It seems that $user
that is created with FOSUserBundle
UserManager is not seen by default EntityManager ($this->getDoctrine->getManager())
and it wants to add it to database. Previously it worked but with some recent FOSUserBundle
update it stopped. Previously USer Manager could add User entity to Database and the EntityManager could add log Entity with a reference to User entity ($owner)
.
Any ideas what is going on and how to fix this?
Upvotes: 0
Views: 119
Reputation: 1431
From the coments to your question.
First you should persiste the Log entity and then add the user to it as owner.
Upvotes: 1