In development, when you updates records in database through a form, it's very interesting to known what have changed and what have not changed.

If you use Doctrine with entities, these informations are easily to determined. For instance with an user entity :

        $uow = $this->em->getUnitOfWork();

        $changeset = $uow->getEntityChangeSet($user);

The changeset result is an array with all fields who have changed with old and new value.

Previous Post