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 new EntityManager#refresh in Doctrine ORM 2.14 #136

Merged
merged 1 commit into from Jan 17, 2023

Conversation

michnovka
Copy link
Contributor

Fixes #135

@michnovka
Copy link
Contributor Author

I am not sure if this is the proper fix tho. The error is complaining about Persistance interface. Any help please @orklah @weirdan ?

@orklah
Copy link
Collaborator

orklah commented Dec 20, 2022

It seems to come from the Persistence\ObjectManagerInterface interface indeed. It would be this stub: https://github.com/psalm/psalm-plugin-doctrine/blob/62dd7fef85469c63739c0252c2d82151617921b5/stubs/ObjectManager.phpstub

However, we don't actually have a stub for refresh that would declare only one argument so a change here should not be needed. Unless they deployed some kind of migration path and Psalm would be confused about which signature it should take?

@michnovka
Copy link
Contributor Author

This is the way I autowire the $entityManager.

class ResellerHelper
{
    public function __construct(
        private readonly EntityManagerInterface $entityManager,
    ) {
    }

so probably, I should fix the EntityManagerInterface also, otherwise this autowiring will fail with psalm. This is btw the exact same approach that is used for the EntityManager#find and EntityManagerInterface#find and $lockMode

@michnovka
Copy link
Contributor Author

@orklah I have pushed new fix for both EntityManager and EntityManagerInterface stubs. Tested on my code and it does resolve the issue.

@michnovka
Copy link
Contributor Author

@orklah can we merge this please?

@orklah orklah merged commit 4f62e33 into psalm:2.x Jan 17, 2023
@orklah
Copy link
Collaborator

orklah commented Jan 17, 2023

Thanks!

@michnovka
Copy link
Contributor Author

Thanks for merging. Can you please release at least a point release?

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

Successfully merging this pull request may close these issues.

Doctrine 2.14: TooManyArguments: Too many arguments for method Doctrine\Persistence\ObjectManager::refresh
2 participants