You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public function preUpdate(PreUpdateEventArgs $eventArgs)
{
$entity = $eventArgs->getEntity();
$em = $eventArgs->getEntityManager();
$uow = $em->getUnitOfWork();
if ($entity instanceof User) {
if ($eventArgs->hasChangedField('finalStatus')) {
$entity->setFinalStatusDate(new \DateTime('now'));
$uow->recomputeSingleEntityChangeSet(
$em->getClassMetadata("MyAdminBundle:User"),
$entity
);
}
if ($eventArgs->hasChangedField('membershipCode')) {
$entity->setMembershipCodeDate(new \DateTime('now'));
$uow->recomputeSingleEntityChangeSet(
$em->getClassMetadata("MyAdminBundle:User"),
$entity
);
}
}
}
...result in this?
Catchable Fatal Error: Argument 3 passed to Doctrine\ORM\Event\PreUpdateEventArgs::**construct() must be an array, null given, called in /var/www/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 995 and defined in /var/www/vendor/doctrine/orm/lib/Doctrine/ORM/Event/PreUpdateEventArgs.php line 47
I'm just setting a time stamp for two updated values. Dumping the 3rd argument in PreUpdateEventArgs.php on line 47 reveals an array of changes. I'm not sure if this is a bug or if I'm performing this simple operation incorrectly.
The text was updated successfully, but these errors were encountered:
Can you write an integration test around it? Looks like the changeset is removed in a particular edge case, but it's hard to figure it out without a test.
Jira issue originally created by user nelfo:
Should this:
...result in this?
Catchable Fatal Error: Argument 3 passed to Doctrine\ORM\Event\PreUpdateEventArgs::**construct() must be an array, null given, called in /var/www/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 995 and defined in /var/www/vendor/doctrine/orm/lib/Doctrine/ORM/Event/PreUpdateEventArgs.php line 47
I'm just setting a time stamp for two updated values. Dumping the 3rd argument in PreUpdateEventArgs.php on line 47 reveals an array of changes. I'm not sure if this is a bug or if I'm performing this simple operation incorrectly.
The text was updated successfully, but these errors were encountered: