G
G
grabbee2020-08-20 20:49:13
symfony
grabbee, 2020-08-20 20:49:13

How to update in Doctrine with a single request with a binding to the manager?

After updating the list of data, they are updated only in the database. entityManager - does not see changes at runtime.

return $this->createQueryBuilder('l')
            ->update()
            ->set('l.some', ':some')
            ->where('l.val = :val')
// ....

    return $this->createQueryBuilder('l')
            ->andWhere('l.val = :val')
// ....


Until the end of processing the request, Doctrine does not take into account changes.

$this->entityManager->clear() - Kills all bindings and creates new entries on subsequent updates.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question