I have create new bundle in src\Moda\CategoryBundle\Controller\DefaultController.php
and a change routing to:
namespace Moda\CategoryBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
class DefaultController extends Controller
{
/**
* @Route("/show", name="_show")
* @Template()
*/
public function indexAction()
{
die('test');
return array();
}
}
and my routing.yml in app/config
moda_category:
resource: "@ModaCategoryBundle/Controller/"
type: annotation
prefix: /
This links dosnt work:
localhost/web/app_dev.php/category/show
localhost/web/app_dev.php/show
Do you know what I am doing wrong?
I think you should import the config.yml
file inside your bundle. So instead of :
moda_category:
resource: "@ModaCategoryBundle/Controller/"
type: annotation
prefix: /
Change it to:
moda_category:
resource: "@ModaCategoryBundle/Resources/config/routing.yml"
type: annotation
prefix: /
And then add the routes you need inside that file.