I am working on the Synfony framework And I am Fresher in Synfony
Framework. I face a problem When I want to run my function I got one error.
Here is my controller:-
<?php
namespace AppBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
class BlogController extends Controller
{
/**
* @Route("/blog")
*/
public function showAction()
{
echo "hello friend";
}
}
?>
my routing.yml file is:-
app:
resource: "@AppBundle/Controller/"
type: annotation
blog_data:
path: /blog
defaults: {_controller: AppBundle:blog:show }
Here I created the blog_data my self and I did not mention it any where because i don't know where it is declare.
my routing.dev.yml file is:-
_wdt: resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml" prefix: /_wdt
_profiler: resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml" prefix: /_profiler
_errors: resource: "@TwigBundle/Resources/config/routing/errors.xml" prefix: /_error
_main: resource: routing.yml
when I hit URL:-
http://localhost/mysymfony/web/app_dev.php/blog
I got the error
The definition of "blog_data" in "C:\xampp\htdocs\mysymfony\app/config\routing.yml" must be a YAML array in C:\xampp\htdocs\mysymfony\app/config\routing.yml (which is being imported from "C:\xampp\htdocs\mysymfony\app/config/routing_dev.yml").
How to resolved this problem.
path
anddefaults
definitions – Andrey Mischenko