I am trying to de-serialize json into Entity and then merge Entity.
I believe that I had this in the past when I sent the identifier and any fields that I wanted to update. For instance:
In my DB:
| id | first | last | city |
| 1 | Jimmy | James | Seattle |
Then I de-serialize the next json and merge the entity
$json = { "id" : 1, "city": "chicago"}
$customer = $serializer->deserialize($json, 'App\CustomerBundle\Entity\Customer', 'json');
$em->merge($customer);
Expected Result:
| id | first | last | city |
| 1 | Jimmy | James | Chicago |
However, I get the following:
| id | first | last | city |
| 1 | null | null | Chicago |
As I said, I believe that at some point this worked, I'm not sure if this is due to jms_serializeror em->merge.
$customer->getFirst() returns null Before and after combining an object
source
share