My issue is that I can't set my controller as the homepage. I have been searching a bit and I found this but it doesn't work when I runt it in production environment. It just works using dev environment.
This is my routing.yml:
homepage:
path: /
defaults: { _controller: DictionaryBundle:Grid:index}
app:
resource: @AppBundle/Controller/
type: annotation
dictionary:
resource: @AppBundle/DictionaryBundle/Controller/
type: annotation
fos_user:
resource: "@FOSUserBundle/Resources/config/routing/all.xml"`
This is my routing routing_dev.yml:
_wdt:
resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml"
prefix: /_wdt
_profiler:
resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml"
prefix: /_profiler
_configurator:
resource: "@SensioDistributionBundle/Resources/config/routing/webconfigurator.xml"
prefix: /_configurator
_main:
resource: routing.yml
homepage:
path: /
defaults: { _controller: DictionaryBundle:Grid:index}
And this is my function:
/**
* @Route("/{lang}", name = "showTranslationsGrid", defaults={"lang":"-"},
* requirements={"lang":"-|en|fr|pt|it"})
* @Template("AppBundle:Dictionary:grid.html.twig")
* Renderiza la vista grid.html.twig que se encarga de generar el grid y cargar los datos
*/
public function indexAction($lang = "-")
{
//utilizamos el servicio para obtener los belong
$belongs = $this->forward('dictionary_util:getBelongsAction')->getContent();
$languages = $this->forward('dictionary_util:getLanguagesAction')->getContent();
$langs=json_decode($languages,true );
return array('lang' => $lang, 'belongs'=> $belongs ,'languages'=> $languages );
}
So, anybody know why something is rendering index.html.twig in app/Resources/views/default in production environment instead of using my controller and rendering my template like dev environment does? I have also remove AcmeDemoBundle following this tutorial and I have cleared chache several times too.
I am working with symfony 2. I have updated to symfony 2.7 few days ago.
app/console --env=prod router:debugto see all configured route in production enviroment, andapp/console --env=prod router:match /to see the actual route which is chosen