You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dunno, if it should be like that - but with the existence of setters, I would expect them to be used, cause you already have initialized object - no need for constructor. To make it work I need to remove properties from constructor.
The text was updated successfully, but these errors were encountered:
priyadi
changed the title
Mapping onto existing objects with constructor
Setter does not get called if the property is also in the constructor
Apr 30, 2024
So the issue for me is - when you are trying to map onto an existing entity, which has constructor and setters - mapping does not work.
Here is an example:
When you do mapping with a new object, passing target object class:
... you get a perfect result:
However, when you try to map onto existing object, let's say, doctrine entity fetched from DB:
... you properties are not changed
Dunno, if it should be like that - but with the existence of setters, I would expect them to be used, cause you already have initialized object - no need for constructor. To make it work I need to remove properties from constructor.
The text was updated successfully, but these errors were encountered: