steevanb / doctrine-read-only-hydrator

Add SimpleObject and ReadOnly hydrators do Doctrine.
GNU General Public License v3.0
57 stars 14 forks source link

PHP Warning: class_implements() in ReadOnlySubscriber #15

Open thedustin opened 4 years ago

thedustin commented 4 years ago

Hey, I found this messages in my error logs:

[20-Jul-2020 13:41:20 Europe/Berlin] PHP Warning:  class_implements(): Class  does not exist and could not be loaded in %kernel.project_dir%/vendor/steevanb/doctrine-read-only-hydrator/EventSubscriber/ReadOnlySubscriber.php on line 64

Installed version: 2.2.3 PHP version: 7.2.26 Symfony version: 4.4.4

I only had a quick look at it, but found no reason for this warning. I saw in the git history that there is already a commit that is trying to fix this problem by catching the thrown exception. The problem with this fix is that it catches the wrong exceptions. A PHP Warning ist not an \Exception, it‘s an \Error (see Errors in PHP 7).

It also seems that the whole method is not working correctly at the moment. The second parameter of class_implements is a boolean which allows to autoload the given class - it does not check whether or not \steevanb\DoctrineReadOnlyHydrator\Entity\ReadOnlyEntityInterface is implemented.

steevanb commented 4 years ago

Hi,

I'm on holidays, i will check tout code in 2 weeks.

Thanks!

thedustin commented 2 years ago

Hello,

as we are currently updating our system to some new major versions, this topic pops up again. Is this repository still maintained? And would you have time to take a look into this issue again, please? 😅

steevanb commented 2 years ago

Hi :)

I've made a little fix here: https://github.com/steevanb/doctrine-read-only-hydrator/pull/24, could you please try it? Depending of your composer.json, you should only need to execute composer require steevanb/doctrine-read-only-hydrator:dev-issue-15

steevanb commented 2 years ago

I'm sorry to ask you do try, i don't have any unit test in this repository...