EntityManagerInterface has no #3/$lockVersion param in find method #7189

Closed
opened 2026-01-22 15:46:22 +01:00 by admin · 4 comments
Owner

Originally created by @mvorisek on GitHub (Jul 27, 2023).

Bug Report

Q A
BC Break n/a
Version 2.15.14 (latest)

Summary

I have found this inconsistency during abstracting entity manager type declaration from EntityManager to EntityManagerInterface.

Current behavior

Currently, in 2.15.x, EntityManager has the following find method prototype: https://github.com/doctrine/orm/blob/v2.5.14/lib/Doctrine/ORM/EntityManager.php#L377 and no find method prototype in EntityManagerInterface.

Given:

it seems the entity manager does support $lockVersion param officially and a missing find method prototype (with #3/$lockVersion param) in EntityManagerInterface is a mistake.

Expected behavior

2.x EntityManagerInterface should declare find method with #3/$lockVersion param (as 3.x does).

Originally created by @mvorisek on GitHub (Jul 27, 2023). ### Bug Report | Q | A |------------ | ------ | BC Break | n/a | Version | 2.15.14 (latest) #### Summary I have found this inconsistency during abstracting entity manager type declaration from EntityManager to EntityManagerInterface. #### Current behavior Currently, in 2.15.x, EntityManager has the following find method prototype: https://github.com/doctrine/orm/blob/v2.5.14/lib/Doctrine/ORM/EntityManager.php#L377 and no find method prototype in EntityManagerInterface. Given: - Entity manager decorator has $lockVersion param: https://github.com/doctrine/orm/blob/v2.5.14/lib/Doctrine/ORM/Decorator/EntityManagerDecorator.php#L178 - and in 3.x the $lockVersion param is declared in the EntityManagerInterface interface: https://github.com/doctrine/orm/blob/3.0.x/lib/Doctrine/ORM/EntityManagerInterface.php#L133 it seems the entity manager does support $lockVersion param officially and a missing find method prototype (with <span>#</span>3/$lockVersion param) in EntityManagerInterface is a mistake. #### Expected behavior 2.x EntityManagerInterface should declare find method with <span>#</span>3/$lockVersion param (as 3.x does).
admin closed this issue 2026-01-22 15:46:22 +01:00
Author
Owner

@derrabus commented on GitHub (Jul 29, 2023):

2.x EntityManagerInterface should declare find method with #3/$lockVersion param (as 3.x does).

This will break each and every userland implementation of the interface out there which is exactly why we won't add the parameter in a minor release.

@derrabus commented on GitHub (Jul 29, 2023): > 2.x EntityManagerInterface should declare find method with #3/$lockVersion param (as 3.x does). This will break each and every userland implementation of the interface out there which is exactly why we won't add the parameter in a minor release.
Author
Owner

@mvorisek commented on GitHub (Jul 29, 2023):

I understand the possible BC break, on the other side, EntityManagerInterface cannot be currently used to replace EntityManager impl. type as it is incomplete.

Can the find method prototype be added as phpdoc above the interface to make both worlds happy?

@mvorisek commented on GitHub (Jul 29, 2023): I understand the possible BC break, on the other side, `EntityManagerInterface` cannot be currently used to replace `EntityManager` impl. type as it is incomplete. Can the `find` method prototype be added as phpdoc above the interface to make both worlds happy?
Author
Owner

@derrabus commented on GitHub (Jul 30, 2023):

If that fixes your problem, why not.

@derrabus commented on GitHub (Jul 30, 2023): If that fixes your problem, why not.
Author
Owner

@mvorisek commented on GitHub (Jul 30, 2023):

I was just about to add @method phpdoc, but how to specify templated return using @method?

@ondrejmirtes is that possible with phpstan?

@mvorisek commented on GitHub (Jul 30, 2023): I was just about to add `@method` phpdoc, but how to specify templated return using `@method`? @ondrejmirtes is that possible with phpstan?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#7189