phpstorm symfony2 missing service warning phpstorm symfony2 missing service warning symfony symfony

phpstorm symfony2 missing service warning


I had a similar problem and would recommend double checking the following...

  1. As @Marcel suggested, check your Symfony2 plugin is turned on...

    1.1. Settings > Symfony2 plugin

    1.2. Check the paths to the these directories are correct, for some reason I had two symfony projects within a project so the default paths were not accurate

Symfony2 plugin

  1. You should double check that the plugin's reference to your container XML is accurate, by default it will be "app\cache\dev\appDevDebugProjectContainer.xml" as you can see mine had to be updated and you can see the path is now "EXISTS", it said "ERROR" before

    2.1. Settings > Symfony2 plugin > Container

    2.2. enter image description here

  2. Then, as per @Igor's suggestion clear your cache


Finally, thanks to the @googol help, I've figured out a way to specify services definitions files in custom paths with a YML format:

You only have to create or modify the .idea/symfony2.xml file including the following tag:xml <option name="containerFiles"> <list> <container_file path="custom/path/to/your/services_definition.yml" /> </list> </option>

You'll have to restart the PhpStorm and that's it! :)

Here you have my complete symfony2.xml file as an example:

xml<?xml version="1.0" encoding="UTF-8"?><project version="4"> <component name="Symfony2PluginSettings"> <option name="pluginEnabled" value="true" /> <option name="twigAnnotateTemplate" value="false" /> <option name="twigAnnotateAsset" value="false" /> <option name="twigAnnotateAssetTags" value="false" /> <option name="twigAnnotateRoute" value="false" /> <option name="twigAnnotateTranslation" value="false" /> <option name="phpAnnotateTemplate" value="false" /> <option name="phpAnnotateService" value="false" /> <option name="phpAnnotateRoute" value="false" /> <option name="phpAnnotateTemplateAnnotation" value="false" /> <option name="phpAnnotateTranslation" value="false" /> <option name="phpHighlightServices" value="true" /> <option name="codeFoldingTwigRoute" value="false" /> <option name="codeFoldingTwigTemplate" value="false" /> <option name="codeFoldingTwigConstant" value="false" /> <option name="containerFiles"> <list> <container_file path="custom/path/to/your/services_definition.yml" /> </list> </option> </component></project>

And here you have a feature request in order to include the possibility to add this custom path service definition through the plugin UI settings instead of having to edit the config file manually: https://github.com/Haehnchen/idea-php-symfony2-plugin/issues/573


Clear the cache for development environment. It should fix it if service really exists. Navigate to your project dir in terminal and type:

app/console ca:c