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

Deprecate not-enabling lazy-ghosts and decouple from doctrine/common's proxies #10837

Merged
merged 1 commit into from
Aug 7, 2023

Conversation

nicolas-grekas
Copy link
Member

This PR deprecates not-enabling lazy-ghosts so that ORM v3 can drop support for doctrine/common's proxies.

It also rewrites ProxyFactory so that when lazy-ghosts are enabled, none of the code in the Doctrine\Common\Proxy namespace is run. This enables deprecating everything related to proxies in doctrine/common.

lib/Doctrine/ORM/ORMInvalidArgumentException.php Outdated Show resolved Hide resolved
lib/Doctrine/ORM/Proxy/ProxyFactory.php Outdated Show resolved Hide resolved
@@ -181,6 +292,8 @@ protected function createProxyDefinition($className)
/**
* Creates a closure capable of initializing a proxy
*
* @deprecated ProxyFactory::createInitializer() is deprecated and will be removed in version 3.0 of doctrine/orm.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to deprecate a private method?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added those to help when cleaning for 3.0. Let me know.

@nicolas-grekas
Copy link
Member Author

PR updated, thanks for the review @derrabus

@nicolas-grekas nicolas-grekas force-pushed the proxy-factory branch 4 times, most recently from 84c6f4c to 21dd52a Compare July 16, 2023 15:24
@nicolas-grekas
Copy link
Member Author

PR rebased, all green!

derrabus
derrabus previously approved these changes Jul 16, 2023
* first time in a request. When the proxied file is changed, the proxy will
* be updated.
*/
public const AUTOGENERATE_FILE_NOT_EXISTS_OR_CHANGED = 4;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be done later: We could think about moving those constants into a separate class, which would allow us to convert that class into an enum in 3.0.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it's worth the trouble for the community, especially because those might not be needed at all with the anticipated native lazy objects.

Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/pull/10837/',
'Not enabling lazy ghost objects is deprecated and will not be supported in Doctrine ORM 3.0. Ensure Doctrine\ORM\Configuration::setLazyGhostObjectEnabled(true) is called to enable them.'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should deprecate calling Configuration::setLazyGhostObjectEnabled(false) as well because true is going to be the only valid setting in 3.0.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's kinda already the case, because if you set this to false, you'll get the deprecation added to ProxyFactory.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see.

@derrabus
Copy link
Member

Rebase needed.

@nicolas-grekas
Copy link
Member Author

Rebased and 🍏

@derrabus derrabus changed the base branch from 2.16.x to 2.17.x August 7, 2023 12:41
@derrabus derrabus merged commit eda1909 into doctrine:2.17.x Aug 7, 2023
41 checks passed
@derrabus derrabus added this to the 2.17.0 milestone Aug 7, 2023
@nicolas-grekas nicolas-grekas deleted the proxy-factory branch August 7, 2023 14:11
nicolas-grekas added a commit to symfony/symfony that referenced this pull request Aug 8, 2023
This PR was merged into the 5.4 branch.

Discussion
----------

[DoctrineBridge] Silence ORM deprecation

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

> Not enabling lazy ghost objects is deprecated and will not be supported in Doctrine ORM 3.0. Ensure Doctrine\ORM\Configuration::setLazyGhostObjectEnabled(true) is called to enable them. (ProxyFactory.php:166 called by EntityManager.php:178, doctrine/orm#10837, package doctrine/orm)

Commits
-------

f42e2c1 [DoctrineBridge] Silence ORM deprecation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants