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

Call to an undefined method <EntityName>Repository::findOneBy<PropertyName>(). #14

Closed
alterphp opened this issue Sep 28, 2017 · 7 comments

Comments

@alterphp
Copy link

Is this kind of error handable ?

@ondrejmirtes
Copy link
Member

This is not yet supported, because PHPStan can define magic methods and properties, but PHPStan does not have any concept of generics, which is needed to know what kind of entity the repository represents.

@ondrejmirtes
Copy link
Member

But you can add the error to ignoreErrors configuration parameter as a regular expression.

@alterphp
Copy link
Author

Thanks, that works perfectly :

	ignoreErrors:
		- '#Call to an undefined method [a-zA-Z0-9\\_]+::findOneBy[A-Z][a-zA-Z]*\(\)#'

@linuxwebexpert
Copy link

Again, many thanks...

This worked Great for Symfony 4 - Doctrine Repository Method called from a Command...

ignoreErrors:
		- '#Call to an undefined method [a-zA-Z0-9\\_]+::deleteRecords\(\)#'

My custom function to truncate old data, we love PHPStan -- and thanks for having solution 👍

@VnK67
Copy link

VnK67 commented Jul 4, 2019

ignoreErrors:
- '#Call to an undefined method [a-zA-Z0-9\_]+::findOneBy[A-Z][a-zA-Z]*()#'

Hi !
Where do you paste that please ? I'm confused

@ondrejmirtes
Copy link
Member

@github-actions
Copy link

github-actions bot commented May 1, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants