Doctrine autocomplete does not work as described
Greetings,
I have checked the doctrine documentation on Jetbrain's website and I have found this page
On paper it looks awesome, but in reality things are sligthly different. When I reach the "Call the methods of a specific entity fetched from the repository" part, it simply does not work, the autocomplete list is empty (except two generic lines) , while my entity has a dozen of methods implemented
And Yes, I know I could add a doc block to specify my variable type, but it would be so much more convenient (and clean) if phpsorm could do it alone, as the jetbrain's documentation says...
Please sign in to leave a comment.
Just to confirm, do you have a Symfony plugin installed and enabled already?
Would it be possible to share a small reproducible project, so I could check how it works on my side?
Ok, sorry. Quote from there:
It appears that your
vendor
directory is broken, so PhpStorm is right when it shows you the warnings about missing classes - those classes are not presented in the project.What I think you need to do is:
vendor
directorycomposer install
(make sure you are doing that remotely, not locally)Deployment | Download from ...
in the context menu on the project root.Can you try it?
For some reason this was it.
The vendor directory was there and working for my project. However ,PHPStorm decided it didn't like something about it so it pretends it is missing. When I started the IDE it was telling me the vendor folder was missing. I looked and I was like, nope there it is right there. I had to delete it and run composer install. Then I restarted PHPStorm, got some other error, the dialog had this button to send the errors but it was greyed out and wouldn't work.
But reinstalling with composer fixes it for some reason. Weird I was programming for days like this wondering WTF it didn't know about my classes anymore. I did a bunch of updates to my Symfony project maybe it did something Phpstorm didn't like.
Thanks.
Do I understand correctly that you managed to fix the error?
I have the same issue. Symfony support, PHP Annotation plugins installed.
Vasiliy Yur Yes I have symfony plugin installed and enabled. Here's my config:
This feature currently doesn't work. It seems like it worked before the latest update. PhpStorm totally fails at this now. For some stupid reason PHPStorm only sees the first 4 methods listed in the comment at the top of the repository the bs findBy etc.
To actually be able to see your custom methods in your repository you must resort to this tomfoolery
Try look here https://intellij-support.jetbrains.com/hc/en-us/requests/3718486
Maybe help you.
Sorry the 404 link doesn't help. It seems to me that this feature worked at one time, then it quit working. The only solution I have found is the one I posted. PhpStorm seems a bit wonky
Yes deleting the vendor folder then running composer install got the doctrine repository code hints working again. I was surprised it only affected PHPStorm though and not the actual project. And what is even more odd is the solution I posted above makes it work too. Thanks.