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

Fix usage of deprecated doctrine/orm StaticPHP driver factory #1755

Conversation

PedroTroller
Copy link

The background

I'm using the latest version of this bundle and the staticphp driver for entity mapping. I'm trying to upgrade to doctrine/orm:3.0.0 and this version of the ORM removes the deprecated Doctrine\ORMapping\Driver\StaticPHPDriver class (replaced by Doctrine\Persistence\Mapping\Driver\StaticPHPDriver).

The problem

In the default DIC settings containing the driver class name staticphp still points to the old class that was deleted by doctrine/orm:3.0.0, it crashes completely after migration

Internal error: Class "Doctrine\ORM\Mapping\Driver\StaticPHPDriver"

The solution

Stop referring to the old class and switch to the new one.

@PedroTroller PedroTroller marked this pull request as ready for review February 12, 2024 17:34
@ostrolucky
Copy link
Member

My only concern here is that this requires doctrine/persistence 3, but this project supports doctrine/persistence ^2.2. I can't see any reason why we cannot bump this requirement, though. Anyone?

@ostrolucky ostrolucky added this to the 2.11.4 milestone Feb 12, 2024
@ostrolucky ostrolucky added the Bug label Feb 12, 2024
@stof
Copy link
Member

stof commented Feb 12, 2024

We should detect the existence of the new class in the DoctrineExtension to keep support for both persistence 2.x (by replacing the value of the parameter). This way, we would keep the same range of support.

@ostrolucky
Copy link
Member

But why do we still need persistence 2.x?

@stof
Copy link
Member

stof commented Feb 12, 2024

Based on https://packagist.org/packages/doctrine/persistence/stats, doctrine/persistence 2.x still has quite some installs. But maybe we could still drop it.

what is sure is that we cannot drop it in 2.11.x. Dropping support for a major version of one of our dependencies should be done in a minor version rather than a patch.

@ostrolucky
Copy link
Member

ostrolucky commented Feb 12, 2024

I also wonder what's even reading these .class parameters. I don't see anything in project referencing them. Perhaps it's some external bundle, or project itself. They shouldn't rely on these .class parameters, they were deprecated long time ago.

@stof
Copy link
Member

stof commented Feb 13, 2024

They are used in the base class of the DI extension.

@ostrolucky
Copy link
Member

ostrolucky commented Feb 13, 2024

In that case, fix should be in doctrine-bridge. It shouldn't read these params anymore. https://github.com/doctrine/DoctrineBundle/blob/2.9.x/UPGRADE-2.1.md#upgrade-from-20-to-21

@ostrolucky ostrolucky removed this from the 2.11.4 milestone Feb 20, 2024
@ostrolucky
Copy link
Member

closing as explained

@clementvtrd
Copy link

@ostrolucky, apologies for the duplicate post 🙏.
Do you have any insight on resolving the issue with the symfony/doctrine-bridge package? I attempted to understand how parameters could be replaced, but I was unsuccessful in identifying the parameter name being referenced.

@ostrolucky
Copy link
Member

Search for addDriver calls in symfony repo

@MatTheCat
Copy link
Contributor

MatTheCat commented Nov 4, 2024

Don’t know if things changed since this PR was opened but it really seems it is DoctrineBundle’s DoctrineExtension using these parameters, like in

return '%' . $this->getObjectManagerElementName('metadata.' . $driverType . '.class') . '%';

EDIT: seems like symfony/symfony#33319 got no follow-up 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants