I'm having trouble configuring a new repository using Symfony 3.4. I used the symfony command to create it with the latest LTS (3.4), and I also add a new Bundle command. My new Bundle works and works well, but I cannot use the view stored inside this package.
I will show you the structure of my bundle:

I want to use this index.html.twig in my controller as follows:
<?php
namespace Lister\ListerBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
class DefaultController extends Controller
{
public function indexAction()
{
return $this->render('ListerListerBundle:Default:index.html.twig');
}
}
But when I try to do this, I have this error.
"ListerListerBundle: : index.html.twig" (:/home/emendiel/Data/Code/Perso/WebLister/app/Resources/views,/home/emendiel/Data/Code//WebLister//Symfony/Symfony/SRC/Symfony//Twig///).
, , , symfony , , , Symfony "ListerBundle/Ressources/views"
, .
: .
,
PS: composer.json
"autoload": {
"psr-4": {
"": "src/"
},
"classmap": [
"app/AppKernel.php",
"app/AppCache.php"
]
},
PSS: My AppKernel:
public function registerBundles()
{
$bundles = [
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new AppBundle\AppBundle(),
new Lister\ListerBundle\ListerListerBundle(),
];
...
: My dependencyInjection

:
configuration.php
<?php
namespace Lister\ListerBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('lister_lister');
return $treeBuilder;
}
}
ListerListerExtension.php
<?php
namespace Lister\ListerBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
class ListerListerExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yml');
}
}
: @Cerad
@ListerLister/Default/index.html.twig
@Cerad
- S3.4 Bundle: Dir: name generate: bundle . , . @ListerLister/Default/index.html.twig . bin/console debug: twig, . - Cerad