Skip to content

Deprecate Proxy interface and related#460

Merged
greg0ire merged 1 commit intodoctrine:5.0.xfrom
GromNaN:deprecate-proxy
Nov 7, 2025
Merged

Deprecate Proxy interface and related#460
greg0ire merged 1 commit intodoctrine:5.0.xfrom
GromNaN:deprecate-proxy

Conversation

@GromNaN
Copy link
Member

@GromNaN GromNaN commented Oct 30, 2025

Native lazy objects don't need proxy classes. By deprecating interfaces and methods related to proxies, we can spot them more easily in integration and ensure we don't use them when native lazy objects are enabled.

*/
public function __construct(
private readonly string $name,
private array $connections,
private array $managers,
private readonly string $defaultConnection,
private readonly string $defaultManager,
private readonly string $proxyInterfaceName,
private readonly string|null $proxyInterfaceName = null,
Copy link
Member Author

@GromNaN GromNaN Oct 30, 2025

Choose a reason for hiding this comment

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

*
* @phpstan-param class-string $className
* @phpstan-param CMTemplate $class
*/
Copy link
Member Author

Choose a reason for hiding this comment

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

This method is never used; last usage removed by

derrabus
derrabus previously approved these changes Oct 30, 2025
@derrabus derrabus requested a review from greg0ire October 30, 2025 15:00
@stof
Copy link
Member

stof commented Oct 30, 2025

Deprecating those seems too early when the package (and the object manager packages implementing the interface) still have actively maintained versions that support PHP 8.3 and older (and so cannot use native lazy objects unconditionally)

@stof
Copy link
Member

stof commented Oct 30, 2025

For reference, the ORM triggers its own deprecation warning about using proxies instead of native lazy objects only when running on PHP 8.4+

@GromNaN
Copy link
Member Author

GromNaN commented Oct 30, 2025

Deprecating those seems too early when the package (and the object manager packages implementing the interface) still have actively maintained versions that support PHP 8.3 and older (and so cannot use native lazy objects unconditionally)

That's what I think too. Deprecations are not triggered directly, but the autoloader will do it. It's mainly to identify classes and interfaces that should no longer be used when native lazy is enabled.

@greg0ire
Copy link
Member

greg0ire commented Oct 31, 2025

I think it might make sense to say that 4.2.x will be the last 4.x, and to bump to 8.4 so that it's fully OK to have these deprecations. We may even release 5.0.0 before v4 of the ORM, and have ORM v3 be compatible with persistence v5 (and it would crash if you would attempt to use the legacy proxies with persistence v5). Then, on orm v4, we drop compatibility with persistence v4. The upgrade path for people would be:

  1. upgrade to ORM 3.4
  2. upgrade to PHP 8.4
  3. enable lazy objects
  4. upgrade to persistence v5
  5. upgrade to ORM v4

@stof
Copy link
Member

stof commented Oct 31, 2025

I think it might make sense to say that 4.2.x will be the last 4.x, and to bump to 8.4 so that it's fully OK to have these deprecations.

this would imply making 4.1.x a maintained version that could receive patches if needed, unless ORM and ODM both drop support for PHP 8.3 first (so that users of a maintained ORM version on PHP 8.3 are not forced to install an unmaintained persistence version.

@greg0ire
Copy link
Member

Ah yes that's not too great. Maybe this needs to be postponed to 5.1.x then

@GromNaN GromNaN changed the base branch from 4.2.x to 5.0.x November 2, 2025 19:42
Copy link
Member

@greg0ire greg0ire left a comment

Choose a reason for hiding this comment

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

I wrote 5.1 but it does not exist yet, and I think starting a new major with deprecations might be OK in this case.

@GromNaN
Copy link
Member Author

GromNaN commented Nov 3, 2025

I wrote 5.1 but it does not exist yet, and I think starting a new major with deprecations might be OK in this case.

I also vote for 5.0.0, otherwise we will just release 5.1.0 right after 5.0.0 and the result will be exactly the same.

Not necessary when using native lazy objects with PHP 8.4+
@greg0ire
Copy link
Member

greg0ire commented Nov 7, 2025

@GromNaN the difference if you do that is that's it's easier to check that all deprecations that are supposed to be removed are removed before releasing 5. But no big deal anyway

@greg0ire greg0ire added this to the 5.0.0 milestone Nov 7, 2025
@greg0ire greg0ire merged commit bacc8ab into doctrine:5.0.x Nov 7, 2025
8 checks passed
@greg0ire
Copy link
Member

greg0ire commented Nov 7, 2025

Thanks @GromNaN !

@GromNaN GromNaN deleted the deprecate-proxy branch November 8, 2025 19:55
GromNaN added a commit to GromNaN/doctrine-persistence that referenced this pull request Dec 4, 2025
GromNaN added a commit to GromNaN/doctrine-persistence that referenced this pull request Dec 4, 2025
@GromNaN GromNaN mentioned this pull request Dec 4, 2025
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.

5 participants