Hi I've got the following query but it doesn't seem to work.
$q = $this->em->createQueryBuilder()
->update('models\User', 'u')
->set('u.username', $username)
->set('u.email', $email)
->where('u.id = ?1')
->setParameter(1, $editId)
->getQuery();
$p = $q->execute();
This returns the following error message:
Fatal error: Uncaught exception 'Doctrine\ORM\Query\QueryException' with message '[Semantical Error] line 0, col 38 near 'testusername WHERE': Error: 'testusername' is not defined.' in ...
I would be glad of any help
I think you need to use
Expr
with->set()
:Either that or make all your values parameters:
Let's say you have some backend showing a list of users (accessible by few admins who might have read/write access on users details).
There you may print users id on their own row as a data attribute in order to retrieve it from Javascript while some event get triggered.
Then an update can be executed this way …
And inside the (ajax) handling action …
Working example using Doctrine 2.5 (on top of Symfony3).