A
A
Alexey Pustoutov2018-03-10 14:19:55
linux
Alexey Pustoutov, 2018-03-10 14:19:55

Symfony doesn't see path to twig template after creating new bundle?

bin/console generate:bundle
answer all questions, tried different config formats. But after generation, the path to the template does not work.
Tried on two computers under Linux mint, but everywhere the same result. Apparently I'm doing something wrong. Help
5aa3bf543ee60247823855.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Pustoutov, 2018-03-11
@alex3319

Generally understood. Thanks to one specialist.
An essence such - I generated the controller through bin/console
In general a problem in the generator. Version 3.4 has a curve.
It was

<?php

namespace AppBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;

class PostController extends Controller
{
    /**
     * @Route("/index")
     */
    public function indexAction()
    {
        return $this->render('AppBundle:Post:index.html.twig', array(
            // ...
        ));
    }

}

It became:
<?php

namespace AppBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;

class PostController extends Controller
{
    /**
     * @Route("/index")
     */
    public function indexAction()
    {
        return $this->render('@App/Post/index.html.twig', array(
            // ...
        ));
    }

}

On error in twig template
Was:
{% extends "::base.html.twig" %}
Became:
{% extends "base.html.twig" %}
And it worked!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question