Mohammed Zayan
Mohammed Zayan

Reputation: 899

Stop Doctrine from executing an update query if no changes made on the form

I want to stop Doctrine from executing an update query if no changes made on the form.

Does anyone have any idea about that?

Upvotes: 1

Views: 196

Answers (1)

Mohammed Zayan
Mohammed Zayan

Reputation: 899

It solved by using UnitOfWork outside of listeners like this code

$uow = $em->getUnitOfWork();
$uow->computeChangeSets();
$changeset = $uow->getEntityChangeSet($user);
if(!empty($changeset)) {
   // my edit code here
}

Upvotes: 1

Related Questions