-
-
Notifications
You must be signed in to change notification settings - Fork 136
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
Doctrine Repository inspections defaulting to arrays #1481
Comments
This appears to be related to pull request #1471 which allowed for type hinting the magic doctrine methods. Specifically the code here c92446c I am not very familiar with how the program works, but perhaps some logic to see if the user has manually overridden then magic methods by writing their own "findBy*" class before defaulting to the magic method determination. |
ignore Doctrine repository return type provider on magic method pattern if already in repository #1481
done as suggested ;) |
@Haehnchen Thanks, I'm still not seeing this change working in 20.200, the same errors persist for me as described in the original post. Maybe my problem would be caught by a second function in (src/test/java/fr/adrienbrault/idea/symfony2plugin/tests/doctrine/fixtures/ObjectRepositoryResultTypeProvider.php)
And then one more test (src/test/java/fr/adrienbrault/idea/symfony2plugin/tests/doctrine/ObjectRepositoryResultTypeProviderTest.java)
That would test my exact problem, I have a repository which is type hinted to return a single object with a findByTitle() class, but the inspection is assuming it returns an array. Thanks for your work on this. |
Using 0.20.195 and I have the following code
$userGroup = $this->getDoctrine()->getRepository(User\UserGroup::class)->findByTitle($userGroupTitle);
In the repository I have the function findByTitle, which is clearly typehinted to return a single UserGroup object:
public function findByTitle(string $title): UserGroup { ... }
This used to not throw a warning, but now I get this warning later when I try to pass the UserGroup
Expected parameter of type '\App\Entity\User\UserGroup', '\App\Entity\User\UserGroup[]' provided
To lay it out more clearly. I have created a custom Repository, where I wrote my own custom findByTitle function. This function has a specified return type. I would expect that return type to be used before the magic method logic is used to determine the return type.
The text was updated successfully, but these errors were encountered: