I have the following code :
$repo = $this->get('doctrine.orm.default_entity_manager')
->getRepository('Acme:Foo');
For the record, the code is working correctly since I can use $repo
, its methods and the resulting entities without a problem.
However PhpStorm highlights the 'doctrine.orm.default_entity_manager'
string and gives me the following error:
Missing service
I get the same error in my services files when referencing that particular service. Following that, obviously, autocomplete does not work. I can use the following workaround, of course:
/** @var \Doctrine\ORM\EntityManager $em */
$em = $this->get('doctrine.orm.default_entity_manager');
$em->getRepository('Acme:Foo');
This way I still get a warning but autocompletion works properly. However, I'd rather keep my code clean from this kind of annotation as much as possible, plus I'm almost sure there's an easy fix for that. I have of course cleared my cache multiple times.
How can I fix this?
EDIT: I need to mention I'm using the Symfony2 plugin.
In PhpStorm i accidentally mark directory "var" as "Excluded"
So my "fix" was easy:
right click on directory, "Mark Directory as" -> "Cancel Exclusion"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With