xiidea / EasyAuditBundle

A Symfony Bundle To Log Selective Events
http://xiidea.github.io/EasyAuditBundle/
MIT License
89 stars 22 forks source link

Bug/Feature? Implement Proxy Objects in DoctrineSubscriber #23

Closed MvanRietschoten closed 6 years ago

MvanRietschoten commented 6 years ago

Hi,

As I use the Change Tracking Policy: Deferred Explicit I need to persist all of my objects if I want them to be saved. But sometimes these objects are Proxy objects like Proxies__CG__\App\DemoAcmeBundle\Entity\User instead of the normal App\DemoAcmeBundle\Entity\User entity that is registered in the config under doctrine_entities. (A workaround is to add the proxy objects there for people finding this post, like this: Proxies\__CG__\App\DemoAcmeBundle\Entity\User: [updated,deleted])

However, I would suggest to add a check for proxy objects and check against the real object in this method: \Xiidea\EasyAuditBundle\Subscriber\DoctrineSubscriber::handleEvent

So... I can work around it, but a fix would be nice :) If I had time I would fix it myself ^^ Hope to help someone who also has the same issue with doctrine proxy objects. Here are some tags people can find this tread on: Easy Audit Bundle Doctrine Events not fired, data or entity saved but listener not triggered.

ronisaha commented 6 years ago

Hi,

Could you please provide an example repo where you getting Proxy classes for DoctrineSubscriber. We should always get original class in listener unless you use Proxies__CG__\App\DemoAcmeBundle\Entity\User. I was unable to reproduce your use case. If you could create a repository with the bug(!), I can look into that.

Happy coding!

pribeirojtm commented 6 years ago

I had the exact same issue as @MvanRietschoten . For now, I'm workarounding with "Proxies__CG__\App\DemoAcmeBundle\Entity\User: [updated,deleted]" configuration for each entity.

ronisaha commented 6 years ago

Could anyone please host a sample project with that bug. I was unable to reproduce that! @MvanRietschoten , @pribeirojtm

ronisaha commented 6 years ago

@MvanRietschoten , @pribeirojtm could you guys check your code without Proxies_CG_\App\* configured with the latest code in master.

pribeirojtm commented 5 years ago

Hi @ronisaha and @MvanRietschoten . I still have the code with ProxiesCG\App* in my config.yml. but my question is if this was solved. It is in the latests release tag? Can I use the latest tag instead the master branch now? :) Thanks.

pribeirojtm commented 5 years ago

Hi @ronisaha and @MvanRietschoten . I still have the code with ProxiesCG\App* in my config.yml. but my question is if this was solved. It is in the latests release tag? Can I use the latest tag instead the master branch now? :) Thanks.

Do you have any news on this? Thanks

ronisaha commented 5 years ago

Sorry for late response, I thought you already know this issue has been fixed from version 1.4.8 and current latest release tag is 1.4.9. You are good to go with latest release tag. The master branch is preparing to drop support for php version as they will be reached to end of life. php 5.6 & 7.0 http://php.net/supported-versions.php.

pribeirojtm commented 5 years ago

Thanks @ronisaha