Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
eichie opened this issue Apr 21, 2022 · 10 comments
Labels
bug Something isn't working

Comments

@eichie
Copy link

eichie commented Apr 21, 2022

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

@Ocramius
Copy link
Member

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

/cc @greg0ire

I think a revert in upstream is kinda needed here.

@Ocramius Ocramius added the bug Something isn't working label Apr 21, 2022
@ppaulis
Copy link

ppaulis commented Apr 21, 2022

@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

@Ocramius
Copy link
Member

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

@greg0ire
Copy link

😟 @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.

@Ocramius
Copy link
Member

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.

@Ocramius
Copy link
Member

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.

@greg0ire
Copy link

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

@greg0ire
Copy link

greg0ire commented Apr 22, 2022

@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 :)

@derrabus
Copy link

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

@eichie
Copy link
Author

eichie commented Apr 25, 2022

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

Thank You! :-)

@eichie eichie closed this as completed Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants