0
votes

Using Doctrine 2.2

When I persist the object it is creating a new entry in DB, when it had id in it which was stored in database.

So I changed from persist to merge, now was able to update the entry. But I also have cascaded entity to be updated. Now the cascaded entity is not getting updated.

I have cascade in parent entity as this

@ORM\OneToMany(targetEntity="Pay_Det", mappedBy="pay", cascade={"persist", "remove"}))

when I change this to have cascade "merge" it gives some weird error and trying to access some protected variable.

Yes my both entity have a field which have same name.(tried changing the name, doesn't help) Any one had similar problem? any solution to this?


Update

I found out that my entity is getting detached. Even after merge doesn't get managed by ORM. It is getting detached because i am using non-ORm to load it before updating.

1
Instead of updated your question with a resolved flag, post an answer and accept it.j0k
was going to do that, did not get time yesterday. Sorry my bad.amitchhajer

1 Answers

0
votes

I found out that my entity is getting detached. Even after merge doesn't get managed by ORM. It is getting detached because i am using non-ORm to load it before updating.