collection-crud/config/services.php

37 lines
1.3 KiB
PHP
Raw Permalink 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;
2023-07-21 10:35:15 -04:00
return static function (ContainerConfigurator $configurator): void {
2022-11-03 10:44:05 -04:00
$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)
2022-11-17 15:32:57 -05:00
->arg('$doctrineHelper', service('maker.doctrine_helper'))
->arg('$formTypeRenderer', service('maker.renderer.form_type_renderer'));
2022-11-03 10:44:05 -04:00
};