Yassine Younes
Yassine Younes

Reputation: 960

Update entity on DB using doctrine entityManager class

I am trying to update a user ( entity name is user ) using doctrine but i can not find a method in the EntityManager class that could do the work.

I have found the methods persist() , remove(), find()... but nothing about update or edit.

Is there something I'm missing or should I just use the createQuery() method?

Upvotes: 0

Views: 408

Answers (1)

Hiruna De Alwis
Hiruna De Alwis

Reputation: 64

  1. Find your user object. (Get to a variable)

  2. Set new values using entity setters.

  3. Finally persist and flush the user object.

Upvotes: 1

Related Questions