-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add lockMode to EntityManager#refresh() #10040
Conversation
TODO: if accepted, update https://www.doctrine-project.org/projects/doctrine-orm/en/latest/reference/transactions-and-concurrency.html to reflect another case to specify LockMode |
014c0ee
to
1914ba7
Compare
Are there any cases against adding the lock mode into |
@derrabus is there anything I can do to have this merged into 2.14? Anything missing from this PR? |
I really wish I had more time to review changes like this one, sorry. 😞 I'm adding it to the 2.14.0 milestone, so we don't forget it this time. One thing though: adding parameters to public methods that are neither final nor internal is a breaking change because that would break code that overrides those methods. However, you could use |
@derrabus well using |
Not an option: we don't accept features for 3.0.x. |
you mean 3.0 is under feature freeze already? or it is too soon yet? |
@derrabus I would then suggest we add |
No, 3.0 is not a feature release. It won't ship a single new feature.
I don't share that sentiment, but I'm open to discussing your solution. |
This is your project, so I am going to implement it with your standards in mind. I just prefer to make BC break in some bigger version release. What versions would be allowed to do that? 2.14? I checked doctrine code and I don't see such hack being used elsewhere, or do you have some example? If this is not used elsewhere to avoid BC breaks, then I really dont want to be the one blamed for starting it in the future. We can ask others also for their opinion, @beberlei @greg0ire ? If the version which would allow changing signature of the 2 public methods |
Funny you mention that kind of hack, we got asked about it today: doctrine/dbal@16efd09#r87189625 Personally, I'm fine with it. In any case, please don't contribute BC-breaks to ORM 3 without also providing an upgrade path in ORM 2. |
@greg0ire what is the proper upgrade path for public method signature change? It seems to me the only way to do this is to just do it and then mention it in UPGRADE.md ... There is nothing like |
One proper way I can think of is using |
Do you want to contribute a feature or do you want to break things? Contribute your feature in a backwards-compatible manner to 2.14. If the feature is accepted, you can clean up BC hacks in 3.0 after your feature has been merged. |
I have pushed commit which doesnt break BC.
When this is merged and changes synced into 3.x, I will commit to the 3.0.x branch to change the signature and remove |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. Please update EntityManagerDecorator
as well. We should also update EntityManagerInterface
, indicating the upcoming change of the method signatures.
Also, we consider the EntityManager
class itself as final, so updating the signatures of public methods would be acceptable there.
I am on vacation till 7th Nov, can u make the changes yourself or it requires my commits? |
We're not in a hurry here. Do it whenever you feel like you have time. 🙂 |
@derrabus so can I get rid of the |
Neither |
Yes, but only on the entity manager.
They do, inherited from |
You can add a
No. We simply add the method including the new parameter in 3.0. No need to change Persistence. |
The interface /**
* Refreshes the persistent state of an object from the database,
* overriding any local changes that have not yet been persisted.
*
* @param object $object The object to refresh.
*
* @return void
*/
public function refresh(object $object); How can we change method signature in |
Sure: https://3v4l.org/9EuXT |
@derrabus aha, I didnt realize that by using default parameter value it can work. Thanks. I have implemented all feedback, this should be ready for a merge. |
Looks good to me. Can you please check if the documentation needs an update? |
Co-authored-by: Alexander M. Turek <[email protected]>
Co-authored-by: Alexander M. Turek <[email protected]>
@derrabus docs updated |
Thank you. |
@derrabus let me know when you merge this into 3.0.x, Ill work to update the signatures on that branch then |
FTR, I've pushed 474f76f. We usually don't baseline Psalm errors from BC layers. |
* 2.14.x: Remove Doctrine\Persistence\ObjectManager::refresh from Psalm baseline Add lockMode to EntityManager#refresh() (doctrine#10040)
* 2.14.x: Remove Doctrine\Persistence\ObjectManager::refresh from Psalm baseline Add lockMode to EntityManager#refresh() (doctrine#10040)
Merged up via #10195 |
@derrabus should I update stubs at https://github.com/psalm/psalm-plugin-doctrine/tree/2.x/stubs ? |
You should direct this question at the authors of that plugin, I guess. I won't stop you. 🙂 |
Attempt to implement #10039