[CRUD] fix error when no crud are created

This commit is contained in:
Julien Fastré 2020-04-21 13:28:24 +02:00
parent 1e06393a7d
commit bd21145701
2 changed files with 6 additions and 4 deletions

View File

@ -113,3 +113,4 @@ Master branch
- [chill entity render] fix error when fallback to default entity render (usage of `__toString()`)
- [CRUD] add step delete
- [CRUD] check that action exists before inserting them in edit and view template
- [CRUD] fix error when no crud are created

View File

@ -99,8 +99,6 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface,
array('homepage' => $config['widgets']['homepage']):
array()
);
$this->configureCruds($container, $config['cruds']);
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yml');
@ -122,7 +120,8 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface,
$loader->load('services/phonenumber.yml');
$loader->load('services/cache.yml');
$loader->load('services/templating.yml');
$loader->load('services/crud.yml');
$this->configureCruds($container, $config['cruds'], $loader);
}
public function getConfiguration(array $config, ContainerBuilder $container)
@ -208,12 +207,14 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface,
* @param array $config the config under 'cruds' key
* @return null
*/
protected function configureCruds(ContainerBuilder $container, $config)
protected function configureCruds(ContainerBuilder $container, $config, Loader\YamlFileLoader $loader)
{
if (count($config) === 0) {
return;
}
$loader->load('services/crud.yml');
$container->setParameter('chill_main_crud_route_loader_config', $config);
$definition = new Definition();