update on Doctrine 2

Asked

Viewed 12 times

0

To perform a symfony update using doctrine2. I know that we first refer to the entity by the id to see if it exists. If it exists we have to modify the object returned by the query. Then we modify this object with access modifiers. Is there a helper to pass the properties of an object to the Doctrine managed object?

  • 1

    What do you mean? Don’t you want to have to do this process you described? Could you give an example of what is this "helper" you want?

  • Example: public Function update(Request $request, $id) { $article =$this->entityManager->find($id); $Object = $this->general('serialize')->deserialize($request->getContent(),Article:class, 'json'); // Here I set all the Article properties of Object. I wanted to avoid that you understood?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.