I am using Symfony3 and getting this error for quote_generator service. I know Symfony3 is not the topic for this course but still any help is appreciated.
[2017-01-16 23:41:40] request.CRITICAL: Uncaught PHP Exception Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: "You have requested a non-existent service "quote_generator"." at /home/vagrant/Code/phpStorm/var/cache/prod/classes.php line 3461 {"exception":"[object] (Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException(code: 0): You have requested a non-existent service \"quote_generator\". at /home/vagrant/Code/phpStorm/var/cache/prod/classes.php:3461)"} []
Meanwhile for other users, there is also an error for form:
[2017-01-16 23:41:40] php.INFO: User Deprecated: Call Form::isValid() with an unsubmitted form is deprecated since version 3.2 and will throw an exception in 4.0. Use Form::isSubmitted() before Form::isValid() instead. {"exception":"[object] (ErrorException(code: 0): User Deprecated: Call Form::isValid() with an unsubmitted form is deprecated since version 3.2 and will throw an exception in 4.0. Use Form::isSubmitted() before Form::isValid() instead. at /home/vagrant/Code/phpStorm/vendor/symfony/symfony/src/Symfony/Component/Form/Form.php:727)"} []
No worries - it's totally fine to ask whatever questions you have :). About the error, I would check your services.yml file: https://knpuniversity.com/screencast/phpstorm/service-shortcuts#registering-a-service. Very simply, if you add the right code there, then you WILL have a quote_generator service. So, somehow, something is going wrong. Oh, and I just realized that your error is showing up in the prod environment! So, if you're using the prod environment, make sure to clear your cache first!
bin/console cache:clear --env=prod
And about the deprecation, yep, pretty self-explanatory - there was a change made in the core of Symfony that will (in the future) require you to say if ($form->isSubmitted() && $form->isValid()) { instead of calling only isValid().
The main plugin you should install and activate is "Symfony plugin", then you can install a few more like "Twig support", "PHP Annotations", "PHP Toolbox"
Oh, and we have a dedicated tutorial about developing using PhpStorm, you may learn a lot of tricks ;) https://knpuniversity.com/s...
Hey Yan, thanks for sharing it! I suppose you mean exactly Symfony 3.3, which with its default configuration makes all services private unless you override some of them if needed.
7 Comments
Thanks for the great tutorial.
I am using Symfony3 and getting this error for quote_generator service. I know Symfony3 is not the topic for this course but still any help is appreciated.
[2017-01-16 23:41:40] request.CRITICAL: Uncaught PHP Exception Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: "You have requested a non-existent service "quote_generator"." at /home/vagrant/Code/phpStorm/var/cache/prod/classes.php line 3461 {"exception":"[object] (Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException(code: 0): You have requested a non-existent service \"quote_generator\". at /home/vagrant/Code/phpStorm/var/cache/prod/classes.php:3461)"} []
Meanwhile for other users, there is also an error for form:
[2017-01-16 23:41:40] php.INFO: User Deprecated: Call Form::isValid() with an unsubmitted form is deprecated since version 3.2 and will throw an exception in 4.0. Use Form::isSubmitted() before Form::isValid() instead. {"exception":"[object] (ErrorException(code: 0): User Deprecated: Call Form::isValid() with an unsubmitted form is deprecated since version 3.2 and will throw an exception in 4.0. Use Form::isSubmitted() before Form::isValid() instead. at /home/vagrant/Code/phpStorm/vendor/symfony/symfony/src/Symfony/Component/Form/Form.php:727)"} []
This one seems self-explanatory.
Thanks
Hey Yahya E.!
No worries - it's totally fine to ask whatever questions you have :). About the error, I would check your services.yml file: https://knpuniversity.com/screencast/phpstorm/service-shortcuts#registering-a-service. Very simply, if you add the right code there, then you WILL have a quote_generator service. So, somehow, something is going wrong. Oh, and I just realized that your error is showing up in the prod environment! So, if you're using the prod environment, make sure to clear your cache first!
And about the deprecation, yep, pretty self-explanatory - there was a change made in the core of Symfony that will (in the future) require you to say
if ($form->isSubmitted() && $form->isValid()) {instead of calling only isValid().Cheers!
which plugin should I use in phpstorm to have class name auto-completion in services.yml like shown in video?
Hey vikbert
The main plugin you should install and activate is "Symfony plugin", then you can install a few more like "Twig support", "PHP Annotations", "PHP Toolbox"
Oh, and we have a dedicated tutorial about developing using PhpStorm, you may learn a lot of tricks ;)
https://knpuniversity.com/s...
Cheers!
If you are using Symfony 3 and getting "ServiceNotFoundException"
Add public: ture under app/config/service.yml file, so it looks like this
Hey Yan, thanks for sharing it! I suppose you mean exactly Symfony 3.3, which with its default configuration makes all services private unless you override some of them if needed.
Cheers!
Yeah, I am using symfony 3.3. Your reply explained why it stop working. Thanks man
"Houston: no signs of life"
Start the conversation!