Closed NullDivision closed 4 years ago
I've also tried to use @TemplateCardBundle/Controller/CardController
but it trips Symphony's kernel saying:
[Sun Aug 16 17:20:27 2015] PHP Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Unable to find file "@TemplateCardBundle/Controller/CardController".' in /home/ancarius/Projects/tpl00001/server/vendor/symfony/http-kernel/Kernel.php:313
Stack trace:
#0 /home/ancarius/Projects/tpl00001/server/vendor/symfony/http-kernel/Config/FileLocator.php(51): Symfony\Component\HttpKernel\Kernel->locateResource('@TemplateCardBu...', '/home/ancarius/...', true)
#1 /home/ancarius/Projects/tpl00001/server/vendor/friendsofsymfony/rest-bundle/FOS/RestBundle/Routing/Loader/RestRouteLoader.php(107): Symfony\Component\HttpKernel\Config\FileLocator->locate('@TemplateCardBu...')
#2 /home/ancarius/Projects/tpl00001/server/vendor/friendsofsymfony/rest-bundle/FOS/RestBundle/Routing/Loader/RestRouteLoader.php(72): FOS\RestBundle\Routing\Loader\RestRouteLoader->getControllerLocator('@TemplateCardBu...')
#3 /home/ancarius/Projects/tpl00001/server/vendor/symfony/config/Loader/FileLoader.php(112): FOS\RestBundle\Routing\Loader\RestRouteLoader->load('@TemplateCard in /home/ancarius/Projects/tpl00001/server/vendor/symfony/config/Loader/FileLoader.php on line 130
[Sun Aug 16 17:20:27 2015] 127.0.0.1:56021 [500]: /app_dev.php/_profiler/477649?panel=router - Uncaught exception 'InvalidArgumentException' with message 'Unable to find file "@TemplateCardBundle/Controller/CardController".' in /home/ancarius/Projects/tpl00001/server/vendor/symfony/http-kernel/Kernel.php:313
Stack trace:
#0 /home/ancarius/Projects/tpl00001/server/vendor/symfony/http-kernel/Config/FileLocator.php(51): Symfony\Component\HttpKernel\Kernel->locateResource('@TemplateCardBu...', '/home/ancarius/...', true)
#1 /home/ancarius/Projects/tpl00001/server/vendor/friendsofsymfony/rest-bundle/FOS/RestBundle/Routing/Loader/RestRouteLoader.php(107): Symfony\Component\HttpKernel\Config\FileLocator->locate('@TemplateCardBu...')
#2 /home/ancarius/Projects/tpl00001/server/vendor/friendsofsymfony/rest-bundle/FOS/RestBundle/Routing/Loader/RestRouteLoader.php(72): FOS\RestBundle\Routing\Loader\RestRouteLoader->getControllerLocator('@TemplateCardBu...')
#3 /home/ancarius/Projects/tpl00001/server/vendor/symfony/config/Loader/FileLoader.php(112): FOS\RestBundle\Routing\Loader\RestRouteLoader->load('@TemplateCard in /home/ancarius/Projects/tpl00001/server/vendor/symfony/config/Loader/FileLoader.php on line 130
You need to use the full class name:
template_card:
type: rest
resource: Template\CardBundle\Controller\CardsController
Tried that too. See my second message.
In your second message, you use @TemplateCardBundle not the full class name!
I've tried using the full qualified namespace. The result is the same. Unless I add .php
to the end (which basically just loads the PHP file as a resource it doesn't work.
can you try this syntax?
https://github.com/gimler/symfony-rest-edition/blob/2.3/app/config/routing_dev.yml#L9
So, I'm trying to integrate FOSRest into my project. I've tried adding the same thing as in the description on the Symphony website but apparently it doesn't work.
This is my router:
app/config/routing.yml
...and the controller:
src/Template/CardBundle/Controller/CardController.php
I get the error: