Skip to content

Logger Event Listener LifecycleEventArgs namespace change #7

Description

@dcatz

Hi @manasbala,

After upgrading from Symfony 4.4 to 5.4 seems symfony/doctrine-bridge changed the LifecycleEventArgs namespace

from Doctrine\Common\Persistence\Event\LifecycleEventArgs
to Doctrine\ORM\Event\LifecycleEventArgs

The proposed change is in this file:

https://github.com/manasbala/doctrine-log-bundle/blob/master/src/EventListener/Logger.php#L5

to be:

use Doctrine\ORM\Event\LifecycleEventArgs;

To avoid the following error:

TypeError: Argument 1 passed to Mb\DoctrineLogBundle\EventListener\Logger::preRemove() 
must be an instance of Doctrine\Common\Persistence\Event\LifecycleEventArgs, 
instance of Doctrine\ORM\Event\LifecycleEventArgs given, 
called in /var/www/vt/vendor/symfony/doctrine-bridge/ContainerAwareEventManager.php on line 68

BTW: I have temporarily fixed it using change suggested by overloading the original class with my class.
Just created the updated Logger.php file in app/resources/compat/DoctrineLogBundle/EventListener and updated composer.json.

"autoload-dev": {
  "psr-4": {
    "Mb\\DoctrineLogBundle\\EventListener\\": "app/resources/compat/DoctrineLogBundle/EventListener",
  }
}, 

Thanks,
Daniel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions