mirror of
https://github.com/doctrine/orm.git
synced 2026-04-29 17:33:15 +02:00
DDC-1584: updated fields won't persist in preUpdate listener #1987
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Jan 6, 2012).
Originally assigned to: @guilhermeblanco on GitHub.
Jira issue originally created by user inori:
Right now any changes made in preUpdate() method are not persisted by default, only workaround is to make UnitOfWork recompute changeset again with something like this:
public function preUpdate(LifecycleEventArgs $eventArgs)
{
$entity = $eventArgs->getEntity();
// do the changes here..
$em = $eventArgs->getEntityManager();
$uow = $em->getUnitOfWork();
$meta = $em->getClassMetadata(get_class($entity));
$uow->recomputeSingleEntityChangeSet($meta, $entity);
}
(if code doesn't format correctly, here's a link: http://groups.google.com/group/symfony2/browse_thread/thread/b40323bcecdbbd9b/8b63f4950674abd5#8b63f4950674abd5 )
@doctrinebot commented on GitHub (Jan 13, 2012):
Comment created by @guilhermeblanco:
This is a known limitation and we marked this in our documentation.
@doctrinebot commented on GitHub (Jan 13, 2012):
Issue was closed with resolution "Invalid"