collection-crud/config/services.php

38 lines
1.4 KiB
PHP
Raw Normal View History

2022-11-03 10:44:05 -04:00
<?php declare(strict_types=1);
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
use App\Maker\MakeCollectionCrud;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return function (ContainerConfigurator $configurator): void {
$parameters = $configurator->parameters();
$parameters->set('locale', 'en');
// 'private' means you cannot fetch services directly from the container via $container->get()
// if you need to do this, you can override this setting on individual services
$services = $configurator->services()
->defaults()
->autowire()
->autoconfigure()
->private();
// makes classes in src/App available to be used as services
// this creates a service per class whose id is the fully-qualified class name
// you can exclude directories or files
// but if a service is unused, it's removed anyway
$services->load('App\\', '../src/*')
->exclude('../src/{Entity,Repository,Tests}');
// controllers are imported separately to make sure they're public
// and have a tag that allows actions to type-hint services
$services->load('App\\Controller\\', '../src/Controller')
->tag('controller.service_arguments');
// Fix wiring of custom CRUD maker class
$services->set(MakeCollectionCrud::class)
->arg('$doctrineHelper', '@maker.doctrine_helper')
->arg('$formTypeRenderer', '@maker.renderer.form_type_renderer');
};