Roave / psr-container-doctrine

Doctrine Factories for PSR-11 Containers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Call to a member function getClassAnnotations() on array with doctrine/orm:^2.12

eichie opened this issue · comments

Moin,

the use of Doctrine\ORM\Mapping\Driver\AnnotationDriver does not work since doctrine/orm:^2.12.

Here in the https://github.com/doctrine/orm/blob/2.12.x/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php the parent class was changed to MappingDriver.

In https://github.com/Roave/psr-container-doctrine/blob/3.6.x/src/DriverFactory.php#L52 it is checked whether this is a subclass of Doctrine\Persistence\Mapping\Driver\AnnotationDriver. However, this class is deprecated and as far as I can see, no more subclasses are provided.

This then leads to the following error:

Call to a member function getClassAnnotations() on array in vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php:82

Seems like an upstream BC break: doctrine/orm#9668

/cc @greg0ire

I think a revert in upstream is kinda needed here.

@Ocramius @eichie FYI, We are discussing potential solutions for the same problem in the Laminas Module:
doctrine/DoctrineModule#774
doctrine/DoctrineModule#775
doctrine/DoctrineModule#776

@ppaulis I think this needs a full revert in upstream.

😟 @Ocramius do you foresee more breakage in other packages or do you think none of the solutions above are acceptable? Regardless of whether this gets revert, should the code in doctrine module be reworked? It seems wrong to assume every child class of AnnotationDriver will have a constructor with the same signature.

It is what it is, @greg0ire: involuntary BC breaks are bugs, and the source/root cause here is doctrine/orm.

Remember that you are only observing the BC breaks on these packages, not what users are doing in closed source software.

As for assumptions: absolutely - these modules are janky integration code, and rework may be needed overall, but that comes by including better static analysis, which would have caught this too.

These packages are old and stable though, so any change introduces risk, rather than value.

Ok, l should be able to work on this soon. I'll revert then work on trying to find a better upgrade path.

@derrabus kindly fixed my sh*t in the latest release, which he is going to tag as 2.12.1 very soon; this can be closed :)

@eichie Can you please check if ORM 2.12.1 fixes your issue?

@derrabus @Ocramius @greg0ire Yes, with version 2.12.1 it works fine again. 👍

Thank You! :-)