I have an service class with the class name NewsService
.
The service is configured as follows:
services:
portal.news:
class: xxx\NewsBundle\Service\NewsService
arguments: ["@doctrine.orm.entity_manager"]
I use Phpstorm with symfony plugin - The plugin finds the service, but Symfony itself does not.
I get the following error message:
An exception has been thrown during the rendering of a template ("You have requested a non-existent service "portal.news".").
How I use the service:
{{ render(controller('xxBundle:Widget:renderNews', {'slice_length': 250})) }}
in the Controller
xxBundle:Widget:renderNews
:$articles = $this->get('portal.news')->getNewestArticles($count);
- cache is cleared
- I checked everything (wrong service configuration, bundle is loaded, syntax is ok, ...)