Hello,

I am using Symfony 2.5 with Doctrine ORM 3.4.

I have an entity which contains a ManyToOne association. I have noticed 
that there is an issue with that association creating some new entities.
I always get the error "A new entity was found through the relationship 
...". I have analyzed it and found out that the corresponding entity looses 
its primary key.

It seems that multiple times reloading the same pages causes the issue, 
first output of my entity looks like this:

object(Proxies\__CG__\Configuration)[241]
>   public '__initializer__' => 
>     object(Closure)[250]
>   public '__cloner__' => 
>     object(Closure)[251]
>   public '__isInitialized__' => boolean false
>   protected 'name' => null
>   protected 'languages' => 
>     array (size=0)
>       empty
>   protected 'specialisations' => 
>     array (size=0)
>       empty
>   protected 'minimumRounds' => int 10
>   protected 'id' => int 1


All okay, second reload:

object(Proxies\__CG__\Configuration)[386]
>   public '__initializer__' => 
>     object(Closure)[249]
>   public '__cloner__' => 
>     object(Closure)[250]
>   public '__isInitialized__' => boolean false
>   protected 'name' => null
>   protected 'languages' => 
>     array (size=0)
>       empty
>   protected 'specialisations' => 
>     array (size=0)
>       empty
>   protected 'minimumRounds' => int 10
>   protected 'id' => int 1 


All okay, but there is an interesting point the id changes from 241 to 386.

object(Proxies\__CG__\Configuration)[341]
>   public '__initializer__' => null
>   public '__cloner__' => null
>   public '__isInitialized__' => boolean true
>   protected 'name' => null
>   protected 'languages' => 
>     array (size=0)
>       empty
>   protected 'specialisations' => 
>     array (size=0)
>       empty
>   protected 'minimumRounds' => int 10
>   protected 'id' => null


Last reload and voila the id is gone and doctrine recognizes the same 
object as before as "new" and I got the error from above.

I don't know what is wrong, because I have tried to load the entity 
directly from the database and have the same behavior.

Please give me some hints to understand the issue.

Thanks in advance! 

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to