diff --git a/composer.json b/composer.json
index 86bdef044c3..f13ae88e271 100644
--- a/composer.json
+++ b/composer.json
@@ -37,7 +37,7 @@
"symfony/asset": "^4.4",
"symfony/config": "^4.4",
"symfony/console": "^4.4",
- "symfony/dependency-injection": "^4.4.3",
+ "symfony/dependency-injection": "^4.4.8",
"symfony/doctrine-bridge": "^4.4",
"symfony/event-dispatcher": "^4.4",
"symfony/event-dispatcher-contracts": "^1.1 || ^2.0",
diff --git a/src/DependencyInjection/SonataAdminExtension.php b/src/DependencyInjection/SonataAdminExtension.php
index 0bf372dce0a..9bb814f3368 100644
--- a/src/DependencyInjection/SonataAdminExtension.php
+++ b/src/DependencyInjection/SonataAdminExtension.php
@@ -18,7 +18,7 @@
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
-use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
+use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType as SymfonyChoiceType;
use Symfony\Component\Form\Extension\Core\Type\DateTimeType as SymfonyDateTimeType;
@@ -59,24 +59,24 @@ public function load(array $configs, ContainerBuilder $container)
]);
}
- $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
- $loader->load('actions.xml');
- $loader->load('block.xml');
- $loader->load('commands.xml');
- $loader->load('core.xml');
- $loader->load('event_listener.xml');
- $loader->load('form_types.xml');
- $loader->load('menu.xml');
- $loader->load('route.xml');
- $loader->load('twig.xml');
- $loader->load('validator.xml');
+ $loader = new PhpFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
+ $loader->load('actions.php');
+ $loader->load('block.php');
+ $loader->load('commands.php');
+ $loader->load('core.php');
+ $loader->load('event_listener.php');
+ $loader->load('form_types.php');
+ $loader->load('menu.php');
+ $loader->load('route.php');
+ $loader->load('twig.php');
+ $loader->load('validator.php');
if (isset($bundles['MakerBundle'])) {
- $loader->load('makers.xml');
+ $loader->load('makers.php');
}
if (isset($bundles['SonataExporterBundle'])) {
- $loader->load('exporter.xml');
+ $loader->load('exporter.php');
}
$configuration = $this->getConfiguration($configs, $container);
@@ -157,7 +157,7 @@ public function load(array $configs, ContainerBuilder $container)
$container->setParameter('sonata.admin.configuration.security.admin_permissions', $config['security']['admin_permissions']);
$container->setParameter('sonata.admin.configuration.security.object_permissions', $config['security']['object_permissions']);
- $loader->load('security.xml');
+ $loader->load('security.php');
$container->setParameter('sonata.admin.extension.map', $config['extensions']);
@@ -272,10 +272,10 @@ private function replacePropertyAccessor(ContainerBuilder $container): void
/**
* NEXT_MAJOR: remove this method.
*/
- private function configureTwigTextExtension(ContainerBuilder $container, XmlFileLoader $loader, array $config): void
+ private function configureTwigTextExtension(ContainerBuilder $container, PhpFileLoader $loader, array $config): void
{
$container->setParameter('sonata.admin.configuration.legacy_twig_text_extension', $config['options']['legacy_twig_text_extension']);
- $loader->load('twig_string.xml');
+ $loader->load('twig_string.php');
if (false !== $config['options']['legacy_twig_text_extension']) {
$container
diff --git a/src/Export/Exporter.php b/src/Export/Exporter.php
index 39f5c23cd17..a475ce96825 100644
--- a/src/Export/Exporter.php
+++ b/src/Export/Exporter.php
@@ -36,6 +36,6 @@ public function __construct()
} else {
class_alias(
BaseExporter::class,
- __NAMESPACE__.'\Exporter'
+ 'Sonata\AdminBundle\Export\Exporter'
);
}
diff --git a/src/Resources/config/actions.php b/src/Resources/config/actions.php
new file mode 100644
index 00000000000..523274b6d28
--- /dev/null
+++ b/src/Resources/config/actions.php
@@ -0,0 +1,86 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+use Sonata\AdminBundle\Action\AppendFormFieldElementAction;
+use Sonata\AdminBundle\Action\DashboardAction;
+use Sonata\AdminBundle\Action\GetShortObjectDescriptionAction;
+use Sonata\AdminBundle\Action\RetrieveAutocompleteItemsAction;
+use Sonata\AdminBundle\Action\RetrieveFormFieldElementAction;
+use Sonata\AdminBundle\Action\SearchAction;
+use Sonata\AdminBundle\Action\SetObjectFieldValueAction;
+use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
+use Symfony\Component\DependencyInjection\Loader\Configurator\ReferenceConfigurator;
+
+return static function (ContainerConfigurator $containerConfigurator): void {
+ // Use "service" function for creating references to services when dropping support for Symfony 4.4
+ // Use "param" function for creating references to parameters when dropping support for Symfony 5.1
+ $containerConfigurator->services()
+
+ ->set(DashboardAction::class, DashboardAction::class)
+ ->public()
+ ->args([
+ '%sonata.admin.configuration.dashboard_blocks%',
+ new ReferenceConfigurator('sonata.admin.breadcrumbs_builder'),
+ new ReferenceConfigurator('sonata.admin.global_template_registry'),
+ new ReferenceConfigurator('sonata.admin.pool'),
+ new ReferenceConfigurator('twig'),
+ ])
+
+ ->set(SearchAction::class, SearchAction::class)
+ ->public()
+ ->args([
+ new ReferenceConfigurator('sonata.admin.pool'),
+ new ReferenceConfigurator('sonata.admin.search.handler'),
+ new ReferenceConfigurator('sonata.admin.global_template_registry'),
+ new ReferenceConfigurator('sonata.admin.breadcrumbs_builder'),
+ new ReferenceConfigurator('twig'),
+ ])
+
+ ->set('sonata.admin.action.append_form_field_element', AppendFormFieldElementAction::class)
+ ->public()
+ ->args([
+ new ReferenceConfigurator('twig'),
+ new ReferenceConfigurator('sonata.admin.pool'),
+ new ReferenceConfigurator('sonata.admin.helper'),
+ ])
+
+ ->set('sonata.admin.action.retrieve_form_field_element', RetrieveFormFieldElementAction::class)
+ ->public()
+ ->args([
+ new ReferenceConfigurator('twig'),
+ new ReferenceConfigurator('sonata.admin.pool'),
+ new ReferenceConfigurator('sonata.admin.helper'),
+ ])
+
+ ->set('sonata.admin.action.get_short_object_description', GetShortObjectDescriptionAction::class)
+ ->public()
+ ->args([
+ new ReferenceConfigurator('twig'),
+ new ReferenceConfigurator('sonata.admin.pool'),
+ ])
+
+ ->set('sonata.admin.action.set_object_field_value', SetObjectFieldValueAction::class)
+ ->public()
+ ->args([
+ new ReferenceConfigurator('twig'),
+ new ReferenceConfigurator('sonata.admin.pool'),
+ new ReferenceConfigurator('validator'),
+ ])
+
+ ->set('sonata.admin.action.retrieve_autocomplete_items', RetrieveAutocompleteItemsAction::class)
+ ->public()
+ ->args([
+ new ReferenceConfigurator('sonata.admin.pool'),
+ ])
+ ;
+};
diff --git a/src/Resources/config/actions.xml b/src/Resources/config/actions.xml
deleted file mode 100644
index 1e3c0e49393..00000000000
--- a/src/Resources/config/actions.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
-
-
- %sonata.admin.configuration.dashboard_blocks%
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Resources/config/block.php b/src/Resources/config/block.php
new file mode 100644
index 00000000000..7102ad86197
--- /dev/null
+++ b/src/Resources/config/block.php
@@ -0,0 +1,51 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+use Sonata\AdminBundle\Block\AdminListBlockService;
+use Sonata\AdminBundle\Block\AdminSearchBlockService;
+use Sonata\AdminBundle\Block\AdminStatsBlockService;
+use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
+use Symfony\Component\DependencyInjection\Loader\Configurator\ReferenceConfigurator;
+
+return static function (ContainerConfigurator $containerConfigurator): void {
+ // Use "service" function for creating references to services when dropping support for Symfony 4.4
+ // Use "param" function for creating references to parameters when dropping support for Symfony 5.1
+ $containerConfigurator->services()
+
+ ->set('sonata.admin.block.admin_list', AdminListBlockService::class)
+ ->public()
+ ->tag('sonata.block')
+ ->args([
+ new ReferenceConfigurator('twig'),
+ new ReferenceConfigurator('sonata.admin.pool'),
+ new ReferenceConfigurator('sonata.admin.global_template_registry'),
+ ])
+
+ ->set('sonata.admin.block.search_result', AdminSearchBlockService::class)
+ ->public()
+ ->tag('sonata.block')
+ ->args([
+ new ReferenceConfigurator('twig'),
+ new ReferenceConfigurator('sonata.admin.pool'),
+ new ReferenceConfigurator('sonata.admin.search.handler'),
+ ])
+
+ ->set('sonata.admin.block.stats', AdminStatsBlockService::class)
+ ->public()
+ ->tag('sonata.block')
+ ->args([
+ new ReferenceConfigurator('twig'),
+ new ReferenceConfigurator('sonata.admin.pool'),
+ ])
+ ;
+};
diff --git a/src/Resources/config/block.xml b/src/Resources/config/block.xml
deleted file mode 100644
index 8b91fca9c15..00000000000
--- a/src/Resources/config/block.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Resources/config/commands.php b/src/Resources/config/commands.php
new file mode 100644
index 00000000000..6106f775afc
--- /dev/null
+++ b/src/Resources/config/commands.php
@@ -0,0 +1,71 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+use Sonata\AdminBundle\Command\CreateClassCacheCommand;
+use Sonata\AdminBundle\Command\ExplainAdminCommand;
+use Sonata\AdminBundle\Command\GenerateObjectAclCommand;
+use Sonata\AdminBundle\Command\ListAdminCommand;
+use Sonata\AdminBundle\Command\SetupAclCommand;
+use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
+use Symfony\Component\DependencyInjection\Loader\Configurator\ReferenceConfigurator;
+
+return static function (ContainerConfigurator $containerConfigurator): void {
+ // Use "service" function for creating references to services when dropping support for Symfony 4.4
+ // Use "param" function for creating references to parameters when dropping support for Symfony 5.1
+ $containerConfigurator->services()
+
+ // NEXT_MAJOR: Remove this service.
+ ->set(CreateClassCacheCommand::class, CreateClassCacheCommand::class)
+ ->public()
+ ->tag('console.command', [
+ 'command' => 'cache:create-cache-class',
+ ])
+ ->deprecate('The "%service_id%" service is deprecated since version sonata-project/admin-bundle 3.39.0 and will be removed in 4.0.')
+ ->args([
+ '%kernel.cache_dir%',
+ '%kernel.debug%',
+ ])
+
+ ->set(ExplainAdminCommand::class, ExplainAdminCommand::class)
+ ->public()
+ ->tag('console.command')
+ ->args([
+ new ReferenceConfigurator('sonata.admin.pool'),
+ new ReferenceConfigurator('validator'),
+ ])
+
+ ->set(GenerateObjectAclCommand::class, GenerateObjectAclCommand::class)
+ ->public()
+ ->tag('console.command')
+ ->args([
+ new ReferenceConfigurator('sonata.admin.pool'),
+ [],
+ (new ReferenceConfigurator('doctrine'))->nullOnInvalid(),
+ ])
+
+ ->set(ListAdminCommand::class, ListAdminCommand::class)
+ ->public()
+ ->tag('console.command')
+ ->args([
+ new ReferenceConfigurator('sonata.admin.pool'),
+ ])
+
+ ->set(SetupAclCommand::class, SetupAclCommand::class)
+ ->public()
+ ->tag('console.command')
+ ->args([
+ new ReferenceConfigurator('sonata.admin.pool'),
+ new ReferenceConfigurator('sonata.admin.manipulator.acl.admin'),
+ ])
+ ;
+};
diff --git a/src/Resources/config/commands.xml b/src/Resources/config/commands.xml
deleted file mode 100644
index cbc706cda63..00000000000
--- a/src/Resources/config/commands.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
- %kernel.cache_dir%
- %kernel.debug%
- The "%service_id%" service is deprecated since version sonata-project/admin-bundle 3.39.0 and will be removed in 4.0.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Resources/config/core.php b/src/Resources/config/core.php
new file mode 100644
index 00000000000..e590b9fff18
--- /dev/null
+++ b/src/Resources/config/core.php
@@ -0,0 +1,232 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+use Sonata\AdminBundle\Admin\AdminHelper;
+use Sonata\AdminBundle\Admin\BreadcrumbsBuilder;
+use Sonata\AdminBundle\Admin\BreadcrumbsBuilderInterface;
+use Sonata\AdminBundle\Admin\Extension\LockExtension;
+use Sonata\AdminBundle\Admin\Pool;
+use Sonata\AdminBundle\Controller\HelperController;
+use Sonata\AdminBundle\Event\AdminEventExtension;
+use Sonata\AdminBundle\Export\Exporter;
+use Sonata\AdminBundle\Filter\FilterFactory;
+use Sonata\AdminBundle\Filter\FilterFactoryInterface;
+use Sonata\AdminBundle\Filter\Persister\FilterPersisterInterface;
+use Sonata\AdminBundle\Filter\Persister\SessionFilterPersister;
+use Sonata\AdminBundle\Model\AuditManager;
+use Sonata\AdminBundle\Model\AuditManagerInterface;
+use Sonata\AdminBundle\Route\AdminPoolLoader;
+use Sonata\AdminBundle\Search\SearchHandler;
+use Sonata\AdminBundle\Templating\MutableTemplateRegistryInterface;
+use Sonata\AdminBundle\Templating\TemplateRegistry;
+use Sonata\AdminBundle\Translator\BCLabelTranslatorStrategy;
+use Sonata\AdminBundle\Translator\Extractor\AdminExtractor;
+use Sonata\AdminBundle\Translator\Extractor\JMSTranslatorBundle\AdminExtractor as DeprecatedAdminExtractor;
+use Sonata\AdminBundle\Translator\FormLabelTranslatorStrategy;
+use Sonata\AdminBundle\Translator\LabelTranslatorStrategyInterface;
+use Sonata\AdminBundle\Translator\NativeLabelTranslatorStrategy;
+use Sonata\AdminBundle\Translator\NoopLabelTranslatorStrategy;
+use Sonata\AdminBundle\Translator\UnderscoreLabelTranslatorStrategy;
+use Sonata\AdminBundle\Twig\GlobalVariables;
+use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
+use Symfony\Component\DependencyInjection\Loader\Configurator\ReferenceConfigurator;
+
+return static function (ContainerConfigurator $containerConfigurator): void {
+ // Use "service" function for creating references to services when dropping support for Symfony 4.4
+ // Use "param" function for creating references to parameters when dropping support for Symfony 5.1
+ $containerConfigurator->services()
+
+ ->set('sonata.admin.pool', Pool::class)
+ ->public()
+ ->args([
+ new ReferenceConfigurator('service_container'),
+ '',
+ '',
+ [],
+ new ReferenceConfigurator('property_accessor'),
+ ])
+ ->call('setTemplateRegistry', [
+ new ReferenceConfigurator('sonata.admin.global_template_registry'),
+ ])
+
+ ->alias(Pool::class, 'sonata.admin.pool')
+
+ ->set('sonata.admin.route_loader', AdminPoolLoader::class)
+ ->public()
+ ->tag('routing.loader')
+ ->args([
+ new ReferenceConfigurator('sonata.admin.pool'),
+ '',
+ new ReferenceConfigurator('service_container'),
+ ])
+
+ ->alias(AdminPoolLoader::class, 'sonata.admin.route_loader')
+
+ ->set('sonata.admin.helper', AdminHelper::class)
+ ->public()
+ ->args([
+ new ReferenceConfigurator('sonata.admin.pool'),
+ ])
+
+ ->alias(AdminHelper::class, 'sonata.admin.helper')
+
+ ->set('sonata.admin.builder.filter.factory', FilterFactory::class)
+ ->public()
+ ->args([
+ new ReferenceConfigurator('service_container'),
+ '',
+ ])
+
+ ->alias(FilterFactory::class, 'sonata.admin.builder.filter.factory')
+
+ ->alias(FilterFactoryInterface::class, 'sonata.admin.builder.filter.factory')
+
+ ->set('sonata.admin.breadcrumbs_builder', BreadcrumbsBuilder::class)
+ ->public()
+ ->args([
+ '%sonata.admin.configuration.breadcrumbs%',
+ ])
+
+ ->alias(BreadcrumbsBuilder::class, 'sonata.admin.breadcrumbs_builder')
+
+ ->alias(BreadcrumbsBuilderInterface::class, 'sonata.admin.breadcrumbs_builder')
+
+ // Services used to format the label, default is sonata.admin.label.strategy.noop
+
+ ->set('sonata.admin.label.strategy.bc', BCLabelTranslatorStrategy::class)
+ ->public()
+
+ ->alias(BCLabelTranslatorStrategy::class, 'sonata.admin.label.strategy.bc')
+
+ ->set('sonata.admin.label.strategy.native', NativeLabelTranslatorStrategy::class)
+ ->public()
+
+ ->alias(NativeLabelTranslatorStrategy::class, 'sonata.admin.label.strategy.native')
+
+ ->alias(LabelTranslatorStrategyInterface::class, 'sonata.admin.label.strategy.native')
+
+ ->set('sonata.admin.label.strategy.noop', NoopLabelTranslatorStrategy::class)
+ ->public()
+
+ ->alias(NoopLabelTranslatorStrategy::class, 'sonata.admin.label.strategy.noop')
+
+ ->set('sonata.admin.label.strategy.underscore', UnderscoreLabelTranslatorStrategy::class)
+ ->public()
+
+ ->alias(UnderscoreLabelTranslatorStrategy::class, 'sonata.admin.label.strategy.underscore')
+
+ ->set('sonata.admin.label.strategy.form_component', FormLabelTranslatorStrategy::class)
+ ->public()
+
+ ->alias(FormLabelTranslatorStrategy::class, 'sonata.admin.label.strategy.form_component')
+
+ // NEXT_MAJOR: Remove this service.
+ ->set('sonata.admin.translator.extractor.jms_translator_bundle', DeprecatedAdminExtractor::class)
+ ->public()
+ ->tag('jms_translation.extractor', [
+ 'alias' => 'sonata_admin',
+ ])
+ ->deprecate('The service "%service_id%" is deprecated in favor of the "Sonata\AdminBundle\Translator\Extractor\AdminExtractor" service since version 3.72 and will be removed in 4.0.')
+ ->args([
+ new ReferenceConfigurator('sonata.admin.pool'),
+ (new ReferenceConfigurator('logger'))->nullOnInvalid(),
+ ])
+ ->call('setBreadcrumbsBuilder', [
+ new ReferenceConfigurator('sonata.admin.breadcrumbs_builder'),
+ ])
+
+ ->set(AdminExtractor::class)
+ ->tag('translation.extractor', [
+ 'alias' => 'sonata_admin',
+ ])
+ ->args([
+ new ReferenceConfigurator('sonata.admin.pool'),
+ new ReferenceConfigurator('sonata.admin.breadcrumbs_builder'),
+ ])
+
+ // NEXT_MAJOR: Remove this service.
+ ->set('sonata.admin.controller.admin', HelperController::class)
+ ->public()
+ ->deprecate('The controller service "%service_id%" is deprecated in favor of several action services since version 3.38.0 and will be removed in 4.0.')
+ ->args([
+ new ReferenceConfigurator('twig'),
+ new ReferenceConfigurator('sonata.admin.pool'),
+ new ReferenceConfigurator('sonata.admin.helper'),
+ new ReferenceConfigurator('validator'),
+ ])
+
+ ->set('sonata.admin.audit.manager', AuditManager::class)
+ ->public()
+ ->args([
+ new ReferenceConfigurator('service_container'),
+ ])
+
+ ->alias(AuditManager::class, 'sonata.admin.audit.manager')
+
+ ->alias(AuditManagerInterface::class, 'sonata.admin.audit.manager')
+
+ // NEXT_MAJOR: Remove this service.
+ ->set('sonata.admin.exporter', Exporter::class)
+ ->public()
+ ->deprecate('The service "%service_id%" is deprecated in favor of the "sonata.exporter.exporter" service since version 3.14 and will be removed in 4.0.')
+
+ ->set('sonata.admin.search.handler', SearchHandler::class)
+ ->public()
+ ->args([
+ '%sonata.admin.configuration.global_search.case_sensitive%',
+ ])
+
+ ->alias(SearchHandler::class, 'sonata.admin.search.handler')
+
+ ->set('sonata.admin.event.extension', AdminEventExtension::class)
+ ->public()
+ ->tag('sonata.admin.extension', ['global' => true])
+ ->args([
+ new ReferenceConfigurator('event_dispatcher'),
+ ])
+
+ ->alias(AdminEventExtension::class, 'sonata.admin.event.extension')
+
+ ->set('sonata.admin.lock.extension', LockExtension::class)
+ ->public()
+ ->tag('sonata.admin.extension', ['global' => true])
+
+ ->set('sonata.admin.twig.global', GlobalVariables::class)
+ ->public()
+ ->args([
+ new ReferenceConfigurator('sonata.admin.pool'),
+ '%sonata.admin.configuration.mosaic_background%',
+ ])
+
+ ->alias(GlobalVariables::class, 'sonata.admin.twig.global')
+
+ ->set('sonata.admin.filter_persister.session', SessionFilterPersister::class)
+ ->args([
+ new ReferenceConfigurator('session'),
+ ])
+
+ ->alias(SessionFilterPersister::class, 'sonata.admin.filter_persister.session')
+
+ ->alias(FilterPersisterInterface::class, 'sonata.admin.filter_persister.session')
+
+ ->set('sonata.admin.global_template_registry', TemplateRegistry::class)
+ ->public()
+ ->args([
+ '%sonata.admin.configuration.templates%',
+ ])
+
+ ->alias(TemplateRegistry::class, 'sonata.admin.global_template_registry')
+
+ ->alias(MutableTemplateRegistryInterface::class, 'sonata.admin.global_template_registry')
+ ;
+};
diff --git a/src/Resources/config/core.xml b/src/Resources/config/core.xml
deleted file mode 100644
index c7f4141e81d..00000000000
--- a/src/Resources/config/core.xml
+++ /dev/null
@@ -1,116 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- %sonata.admin.configuration.breadcrumbs%
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- The controller service "%service_id%" is deprecated in favor of several action services since version 3.38.0 and will be removed in 4.0.
-
-
-
-
-
-
-
-
-
-
-
-
-
- The service "%service_id%" is deprecated in favor of the "sonata.exporter.exporter" service since version 3.14 and will be removed in 4.0.
-
-
- %sonata.admin.configuration.global_search.case_sensitive%
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- %sonata.admin.configuration.mosaic_background%
-
-
-
-
-
-
-
-
-
-
- %sonata.admin.configuration.templates%
-
-
-
-
-
diff --git a/src/Resources/config/event_listener.php b/src/Resources/config/event_listener.php
new file mode 100644
index 00000000000..12923de6081
--- /dev/null
+++ b/src/Resources/config/event_listener.php
@@ -0,0 +1,34 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+use Sonata\AdminBundle\EventListener\AssetsInstallCommandListener;
+use Symfony\Component\Console\ConsoleEvents;
+use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
+use Symfony\Component\DependencyInjection\Loader\Configurator\ReferenceConfigurator;
+
+return static function (ContainerConfigurator $containerConfigurator): void {
+ // Use "service" function for creating references to services when dropping support for Symfony 4.4
+ // Use "param" function for creating references to parameters when dropping support for Symfony 5.1
+ $containerConfigurator->services()
+
+ ->set(AssetsInstallCommandListener::class)
+ ->tag('kernel.event_listener', [
+ 'event' => ConsoleEvents::TERMINATE,
+ 'method' => 'copySonataCoreBundleAssets',
+ ])
+ ->args([
+ new ReferenceConfigurator('filesystem'),
+ '%kernel.project_dir%',
+ ])
+ ;
+};
diff --git a/src/Resources/config/event_listener.xml b/src/Resources/config/event_listener.xml
deleted file mode 100644
index 0499a3ae8c5..00000000000
--- a/src/Resources/config/event_listener.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
- %kernel.project_dir%
-
-
-
-
diff --git a/src/Resources/config/exporter.php b/src/Resources/config/exporter.php
new file mode 100644
index 00000000000..763026a0009
--- /dev/null
+++ b/src/Resources/config/exporter.php
@@ -0,0 +1,29 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+use Sonata\AdminBundle\Bridge\Exporter\AdminExporter;
+use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
+use Symfony\Component\DependencyInjection\Loader\Configurator\ReferenceConfigurator;
+
+return static function (ContainerConfigurator $containerConfigurator): void {
+ // Use "service" function for creating references to services when dropping support for Symfony 4.4
+ // Use "param" function for creating references to parameters when dropping support for Symfony 5.1
+ $containerConfigurator->services()
+
+ ->set('sonata.admin.admin_exporter', AdminExporter::class)
+ ->public()
+ ->args([
+ new ReferenceConfigurator('sonata.exporter.exporter'),
+ ])
+ ;
+};
diff --git a/src/Resources/config/exporter.xml b/src/Resources/config/exporter.xml
deleted file mode 100644
index b188ae04872..00000000000
--- a/src/Resources/config/exporter.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/src/Resources/config/form_types.php b/src/Resources/config/form_types.php
new file mode 100644
index 00000000000..7282e8e2392
--- /dev/null
+++ b/src/Resources/config/form_types.php
@@ -0,0 +1,147 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+use Sonata\AdminBundle\Form\Extension\ChoiceTypeExtension;
+use Sonata\AdminBundle\Form\Extension\Field\Type\FormTypeFieldExtension;
+use Sonata\AdminBundle\Form\Extension\Field\Type\MopaCompatibilityTypeFieldExtension;
+use Sonata\AdminBundle\Form\Type\AdminType;
+use Sonata\AdminBundle\Form\Type\ChoiceFieldMaskType;
+use Sonata\AdminBundle\Form\Type\CollectionType;
+use Sonata\AdminBundle\Form\Type\Filter\ChoiceType;
+use Sonata\AdminBundle\Form\Type\Filter\DateRangeType;
+use Sonata\AdminBundle\Form\Type\Filter\DateTimeRangeType;
+use Sonata\AdminBundle\Form\Type\Filter\DateTimeType;
+use Sonata\AdminBundle\Form\Type\Filter\DateType;
+use Sonata\AdminBundle\Form\Type\Filter\DefaultType;
+use Sonata\AdminBundle\Form\Type\Filter\NumberType;
+use Sonata\AdminBundle\Form\Type\ModelAutocompleteType;
+use Sonata\AdminBundle\Form\Type\ModelHiddenType;
+use Sonata\AdminBundle\Form\Type\ModelListType;
+use Sonata\AdminBundle\Form\Type\ModelReferenceType;
+use Sonata\AdminBundle\Form\Type\ModelType;
+use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
+use Symfony\Component\DependencyInjection\Loader\Configurator\ReferenceConfigurator;
+use Symfony\Component\Form\Extension\Core\Type\FormType;
+
+return static function (ContainerConfigurator $containerConfigurator): void {
+ // Use "service" function for creating references to services when dropping support for Symfony 4.4
+ // Use "param" function for creating references to parameters when dropping support for Symfony 5.1
+ $containerConfigurator->services()
+
+ ->set('sonata.admin.form.type.admin', AdminType::class)
+ ->public()
+ ->tag('form.type', ['alias' => 'sonata_type_admin'])
+ ->args([
+ new ReferenceConfigurator('sonata.admin.helper'),
+ ])
+
+ ->set('sonata.admin.form.type.model_choice', ModelType::class)
+ ->public()
+ ->tag('form.type', ['alias' => 'sonata_type_model'])
+ ->args([
+ new ReferenceConfigurator('property_accessor'),
+ ])
+
+ ->set('sonata.admin.form.type.model_list', ModelListType::class)
+ ->public()
+ ->tag('form.type', ['alias' => 'sonata_type_model_list'])
+
+ ->set('sonata.admin.form.type.model_reference', ModelReferenceType::class)
+ ->public()
+ ->tag('form.type', ['alias' => 'sonata_type_model_reference'])
+
+ ->set('sonata.admin.form.type.model_hidden', ModelHiddenType::class)
+ ->public()
+ ->tag('form.type', ['alias' => 'sonata_type_model_hidden'])
+
+ ->set('sonata.admin.form.type.model_autocomplete', ModelAutocompleteType::class)
+ ->public()
+ ->tag('form.type', ['alias' => 'sonata_type_model_autocomplete'])
+
+ ->set('sonata.admin.form.type.collection', CollectionType::class)
+ ->public()
+ ->tag('form.type', ['alias' => 'sonata_type_native_collection'])
+
+ ->set('sonata.admin.doctrine_orm.form.type.choice_field_mask', ChoiceFieldMaskType::class)
+ ->public()
+ ->tag('form.type', ['alias' => 'sonata_type_choice_field_mask'])
+
+ ->set('sonata.admin.form.extension.field', FormTypeFieldExtension::class)
+ ->public()
+ ->tag('form.type_extension', [
+ 'alias' => 'form',
+ 'extended_type' => FormType::class,
+ ])
+ ->args(['', ''])
+
+ ->set('sonata.admin.form.extension.field.mopa', MopaCompatibilityTypeFieldExtension::class)
+ ->public()
+ ->tag('form.type_extension', [
+ 'alias' => 'form',
+ 'extended_type' => FormType::class,
+ ])
+
+ ->set('sonata.admin.form.extension.choice', ChoiceTypeExtension::class)
+ ->public()
+ ->tag('form.type_extension', [
+ 'alias' => 'choice',
+ 'extended_type' => SymfonyChoiceType::class,
+ ])
+
+ ->set('sonata.admin.form.filter.type.number', NumberType::class)
+ ->public()
+ ->tag('form.type', ['alias' => 'sonata_type_filter_number'])
+ ->args([
+ new ReferenceConfigurator('translator'),
+ ])
+
+ ->set('sonata.admin.form.filter.type.choice', ChoiceType::class)
+ ->public()
+ ->tag('form.type', ['alias' => 'sonata_type_filter_choice'])
+ ->args([
+ new ReferenceConfigurator('translator'),
+ ])
+
+ ->set('sonata.admin.form.filter.type.default', DefaultType::class)
+ ->public()
+ ->tag('form.type', ['alias' => 'sonata_type_filter_default'])
+
+ ->set('sonata.admin.form.filter.type.date', DateType::class)
+ ->public()
+ ->tag('form.type', ['alias' => 'sonata_type_filter_date'])
+ ->args([
+ new ReferenceConfigurator('translator'),
+ ])
+
+ ->set('sonata.admin.form.filter.type.daterange', DateRangeType::class)
+ ->public()
+ ->tag('form.type', ['alias' => 'sonata_type_filter_date_range'])
+ ->args([
+ new ReferenceConfigurator('translator'),
+ ])
+
+ ->set('sonata.admin.form.filter.type.datetime', DateTimeType::class)
+ ->public()
+ ->tag('form.type', ['alias' => 'sonata_type_filter_datetime'])
+ ->args([
+ new ReferenceConfigurator('translator'),
+ ])
+
+ ->set('sonata.admin.form.filter.type.datetime_range', DateTimeRangeType::class)
+ ->public()
+ ->tag('form.type', ['alias' => 'sonata_type_filter_datetime_range'])
+ ->args([
+ new ReferenceConfigurator('translator'),
+ ])
+ ;
+};
diff --git a/src/Resources/config/form_types.xml b/src/Resources/config/form_types.xml
deleted file mode 100644
index fd0e97ee032..00000000000
--- a/src/Resources/config/form_types.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Resources/config/makers.php b/src/Resources/config/makers.php
new file mode 100644
index 00000000000..6ee8247e96a
--- /dev/null
+++ b/src/Resources/config/makers.php
@@ -0,0 +1,29 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+use Sonata\AdminBundle\Maker\AdminMaker;
+use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
+
+return static function (ContainerConfigurator $containerConfigurator): void {
+ // Use "service" function for creating references to services when dropping support for Symfony 4.4
+ // Use "param" function for creating references to parameters when dropping support for Symfony 5.1
+ $containerConfigurator->services()
+
+ ->set('sonata.admin.maker', AdminMaker::class)
+ ->tag('maker.command')
+ ->args([
+ '%kernel.project_dir%',
+ [],
+ ])
+ ;
+};
diff --git a/src/Resources/config/makers.xml b/src/Resources/config/makers.xml
deleted file mode 100644
index 92c2695f0fd..00000000000
--- a/src/Resources/config/makers.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
- %kernel.project_dir%
-
-
-
-
-
diff --git a/src/Resources/config/menu.php b/src/Resources/config/menu.php
new file mode 100644
index 00000000000..ad7bdd488fe
--- /dev/null
+++ b/src/Resources/config/menu.php
@@ -0,0 +1,72 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+use Knp\Menu\MenuItem;
+use Sonata\AdminBundle\Menu\Matcher\Voter\ActiveVoter;
+use Sonata\AdminBundle\Menu\Matcher\Voter\AdminVoter;
+use Sonata\AdminBundle\Menu\Matcher\Voter\ChildrenVoter;
+use Sonata\AdminBundle\Menu\MenuBuilder;
+use Sonata\AdminBundle\Menu\Provider\GroupMenuProvider;
+use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
+use Symfony\Component\DependencyInjection\Loader\Configurator\ReferenceConfigurator;
+
+return static function (ContainerConfigurator $containerConfigurator): void {
+ // Use "service" function for creating references to services when dropping support for Symfony 4.4
+ // Use "param" function for creating references to parameters when dropping support for Symfony 5.1
+ $containerConfigurator->services()
+
+ ->set('sonata.admin.menu_builder', MenuBuilder::class)
+ ->public()
+ ->args([
+ new ReferenceConfigurator('sonata.admin.pool'),
+ new ReferenceConfigurator('knp_menu.factory'),
+ new ReferenceConfigurator('knp_menu.menu_provider'),
+ new ReferenceConfigurator('event_dispatcher'),
+ ])
+
+ ->set('sonata.admin.sidebar_menu', MenuItem::class)
+ ->public()
+ ->tag('knp_menu.menu', ['alias' => 'sonata_admin_sidebar'])
+ ->factory([
+ new ReferenceConfigurator('sonata.admin.menu_builder'),
+ 'createSidebarMenu',
+ ])
+
+ ->set('sonata.admin.menu.group_provider', GroupMenuProvider::class)
+ ->tag('knp_menu.provider')
+ ->args([
+ new ReferenceConfigurator('knp_menu.factory'),
+ new ReferenceConfigurator('sonata.admin.pool'),
+ new ReferenceConfigurator('security.authorization_checker'),
+ ])
+
+ ->set('sonata.admin.menu.matcher.voter.admin', AdminVoter::class)
+ ->public()
+ ->tag('knp_menu.voter')
+ ->args([
+ new ReferenceConfigurator('request_stack'),
+ ])
+
+ // NEXT_MAJOR: Remove this service.
+ ->set('sonata.admin.menu.matcher.voter.children', ChildrenVoter::class)
+ ->public()
+ ->deprecate('The "%service_id%" service is deprecated since 3.28 and will be removed in 4.0.')
+ ->args([
+ new ReferenceConfigurator('knp_menu.matcher'),
+ ])
+
+ ->set('sonata.admin.menu.matcher.voter.active', ActiveVoter::class)
+ ->public()
+ ->tag('knp_menu.voter')
+ ;
+};
diff --git a/src/Resources/config/menu.xml b/src/Resources/config/menu.xml
deleted file mode 100644
index 8f87d94c753..00000000000
--- a/src/Resources/config/menu.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Resources/config/route.php b/src/Resources/config/route.php
new file mode 100644
index 00000000000..75e63e8528c
--- /dev/null
+++ b/src/Resources/config/route.php
@@ -0,0 +1,61 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+use Sonata\AdminBundle\Route\DefaultRouteGenerator;
+use Sonata\AdminBundle\Route\PathInfoBuilder;
+use Sonata\AdminBundle\Route\QueryStringBuilder;
+use Sonata\AdminBundle\Route\RoutesCache;
+use Sonata\AdminBundle\Route\RoutesCacheWarmUp;
+use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
+use Symfony\Component\DependencyInjection\Loader\Configurator\ReferenceConfigurator;
+
+return static function (ContainerConfigurator $containerConfigurator): void {
+ // Use "service" function for creating references to services when dropping support for Symfony 4.4
+ // Use "param" function for creating references to parameters when dropping support for Symfony 5.1
+ $containerConfigurator->services()
+
+ ->set('sonata.admin.route.path_info', PathInfoBuilder::class)
+ ->public()
+ ->args([
+ new ReferenceConfigurator('sonata.admin.audit.manager'),
+ ])
+
+ ->set('sonata.admin.route.query_string', QueryStringBuilder::class)
+ ->public()
+ ->args([
+ new ReferenceConfigurator('sonata.admin.audit.manager'),
+ ])
+
+ ->set('sonata.admin.route.default_generator', DefaultRouteGenerator::class)
+ ->public()
+ ->args([
+ new ReferenceConfigurator('router'),
+ new ReferenceConfigurator('sonata.admin.route.cache'),
+ ])
+
+ ->set('sonata.admin.route.cache', RoutesCache::class)
+ ->public()
+ ->args([
+ '%kernel.cache_dir%/sonata/admin',
+ '%kernel.debug%',
+ ])
+
+ ->set('sonata.admin.route.cache_warmup', RoutesCacheWarmUp::class)
+ ->public()
+ ->tag('kernel.cache_warmer')
+ ->args([
+ new ReferenceConfigurator('sonata.admin.route.cache'),
+ new ReferenceConfigurator('sonata.admin.pool'),
+ ])
+ ;
+};
diff --git a/src/Resources/config/route.xml b/src/Resources/config/route.xml
deleted file mode 100644
index d055132950f..00000000000
--- a/src/Resources/config/route.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- %kernel.cache_dir%/sonata/admin
- %kernel.debug%
-
-
-
-
-
-
-
-
diff --git a/src/Resources/config/security.php b/src/Resources/config/security.php
new file mode 100644
index 00000000000..4c01045f089
--- /dev/null
+++ b/src/Resources/config/security.php
@@ -0,0 +1,79 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+use Sonata\AdminBundle\Security\Acl\Permission\MaskBuilder;
+use Sonata\AdminBundle\Security\Handler\AclSecurityHandler;
+use Sonata\AdminBundle\Security\Handler\NoopSecurityHandler;
+use Sonata\AdminBundle\Security\Handler\RoleSecurityHandler;
+use Sonata\AdminBundle\Util\AdminAclManipulator;
+use Sonata\AdminBundle\Util\AdminObjectAclManipulator;
+use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
+use Symfony\Component\DependencyInjection\Loader\Configurator\ReferenceConfigurator;
+
+return static function (ContainerConfigurator $containerConfigurator): void {
+ $containerConfigurator->parameters()
+
+ ->set('sonata.admin.security.handler.noop.class', NoopSecurityHandler::class)
+
+ ->set('sonata.admin.security.handler.role.class', RoleSecurityHandler::class)
+
+ ->set('sonata.admin.security.handler.acl.class', AclSecurityHandler::class)
+
+ ->set('sonata.admin.security.mask.builder.class', MaskBuilder::class)
+
+ ->set('sonata.admin.manipulator.acl.admin.class', AdminAclManipulator::class)
+
+ ->set('sonata.admin.object.manipulator.acl.admin.class', AdminObjectAclManipulator::class)
+ ;
+
+ // Use "service" function for creating references to services when dropping support for Symfony 4.4
+ // Use "param" function for creating references to parameters when dropping support for Symfony 5.1
+ $containerConfigurator->services()
+
+ ->set('sonata.admin.security.handler.noop', '%sonata.admin.security.handler.noop.class%')
+
+ ->set('sonata.admin.security.handler.role', '%sonata.admin.security.handler.role.class%')
+ ->args([
+ new ReferenceConfigurator('security.authorization_checker'),
+ [
+ '%sonata.admin.configuration.security.role_super_admin%',
+ ],
+ ])
+
+ ->set('sonata.admin.security.handler.acl', '%sonata.admin.security.handler.acl.class%')
+ ->args([
+ new ReferenceConfigurator('security.token_storage'),
+ new ReferenceConfigurator('security.authorization_checker'),
+ (new ReferenceConfigurator('security.acl.provider'))->nullOnInvalid(),
+ '%sonata.admin.security.mask.builder.class%',
+ [
+ '%sonata.admin.configuration.security.role_super_admin%',
+ ],
+ ])
+ ->call('setAdminPermissions', ['%sonata.admin.configuration.security.admin_permissions%'])
+ ->call('setObjectPermissions', ['%sonata.admin.configuration.security.object_permissions%'])
+
+ ->set('sonata.admin.manipulator.acl.admin', '%sonata.admin.manipulator.acl.admin.class%')
+ ->public()
+ ->args([
+ '%sonata.admin.security.mask.builder.class%',
+ ])
+
+ ->set('sonata.admin.object.manipulator.acl.admin', '%sonata.admin.object.manipulator.acl.admin.class%')
+ ->public()
+ ->args([
+ new ReferenceConfigurator('form.factory'),
+ '%sonata.admin.security.mask.builder.class%',
+ ])
+ ;
+};
diff --git a/src/Resources/config/security.xml b/src/Resources/config/security.xml
deleted file mode 100644
index 27547f26dd7..00000000000
--- a/src/Resources/config/security.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
- Sonata\AdminBundle\Security\Handler\NoopSecurityHandler
- Sonata\AdminBundle\Security\Handler\RoleSecurityHandler
- Sonata\AdminBundle\Security\Handler\AclSecurityHandler
- Sonata\AdminBundle\Security\Acl\Permission\MaskBuilder
- Sonata\AdminBundle\Util\AdminAclManipulator
- Sonata\AdminBundle\Util\AdminObjectAclManipulator
-
-
-
-
-
-
- %sonata.admin.configuration.security.role_super_admin%
-
-
-
-
-
-
- %sonata.admin.security.mask.builder.class%
-
- %sonata.admin.configuration.security.role_super_admin%
-
-
- %sonata.admin.configuration.security.admin_permissions%
-
-
- %sonata.admin.configuration.security.object_permissions%
-
-
-
- %sonata.admin.security.mask.builder.class%
-
-
-
- %sonata.admin.security.mask.builder.class%
-
-
-
diff --git a/src/Resources/config/twig.php b/src/Resources/config/twig.php
new file mode 100644
index 00000000000..b3b51f8d37b
--- /dev/null
+++ b/src/Resources/config/twig.php
@@ -0,0 +1,66 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+use Sonata\AdminBundle\Twig\Extension\SonataAdminExtension;
+use Sonata\AdminBundle\Twig\Extension\TemplateRegistryExtension;
+use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
+use Symfony\Component\DependencyInjection\Loader\Configurator\ReferenceConfigurator;
+
+return static function (ContainerConfigurator $containerConfigurator): void {
+ $containerConfigurator->parameters()
+
+ ->set('sonata.admin.twig.extension.x_editable_type_mapping', [
+ 'choice' => 'select',
+ 'boolean' => 'select',
+ 'text' => 'text',
+ 'textarea' => 'textarea',
+ 'html' => 'textarea',
+ 'email' => 'email',
+ 'string' => 'text',
+ 'smallint' => 'text',
+ 'bigint' => 'text',
+ 'integer' => 'number',
+ 'decimal' => 'number',
+ 'currency' => 'number',
+ 'percent' => 'number',
+ 'url' => 'url',
+ 'date' => 'date',
+ ])
+ ;
+
+ // Use "service" function for creating references to services when dropping support for Symfony 4.4
+ // Use "param" function for creating references to parameters when dropping support for Symfony 5.1
+ $containerConfigurator->services()
+
+ ->set('sonata.admin.twig.extension', SonataAdminExtension::class)
+ ->public()
+ ->tag('twig.extension')
+ ->args([
+ new ReferenceConfigurator('sonata.admin.pool'),
+ (new ReferenceConfigurator('logger'))->nullOnInvalid(),
+ new ReferenceConfigurator('translator'),
+ new ReferenceConfigurator('service_container'),
+ new ReferenceConfigurator('security.authorization_checker'),
+ ])
+ ->call('setXEditableTypeMapping', [
+ '%sonata.admin.twig.extension.x_editable_type_mapping%',
+ ])
+
+ ->set('sonata.templates.twig.extension', TemplateRegistryExtension::class)
+ ->tag('twig.extension')
+ ->args([
+ new ReferenceConfigurator('sonata.admin.global_template_registry'),
+ new ReferenceConfigurator('service_container'),
+ ])
+ ;
+};
diff --git a/src/Resources/config/twig.xml b/src/Resources/config/twig.xml
deleted file mode 100644
index cd9431fa5b5..00000000000
--- a/src/Resources/config/twig.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
-
- select
- select
- text
- textarea
- textarea
- email
- text
- text
- text
- number
- number
- number
- number
- url
- date
-
-
-
-
-
-
-
-
-
-
-
-
- %sonata.admin.twig.extension.x_editable_type_mapping%
-
-
-
-
-
-
-
-
-
diff --git a/src/Resources/config/twig_string.php b/src/Resources/config/twig_string.php
new file mode 100644
index 00000000000..6da23e3e9ee
--- /dev/null
+++ b/src/Resources/config/twig_string.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+use Sonata\AdminBundle\Twig\Extension\DeprecatedTextExtension;
+use Sonata\AdminBundle\Twig\Extension\StringExtension;
+use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
+
+return static function (ContainerConfigurator $containerConfigurator): void {
+ $containerConfigurator->services()
+
+ ->set('sonata.string.twig.extension', StringExtension::class)
+ ->tag('twig.extension')
+ ->args([
+ null,
+ ])
+
+ ->set('sonata.deprecated_text.twig.extension', DeprecatedTextExtension::class)
+ ->tag('twig.extension')
+ ->deprecate('The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.')
+ ;
+};
diff --git a/src/Resources/config/twig_string.xml b/src/Resources/config/twig_string.xml
deleted file mode 100644
index 3136aaa9368..00000000000
--- a/src/Resources/config/twig_string.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
- null
-
-
-
-
-
-
-
diff --git a/src/Resources/config/validator.php b/src/Resources/config/validator.php
new file mode 100644
index 00000000000..07b894db89e
--- /dev/null
+++ b/src/Resources/config/validator.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+use Sonata\Form\Validator\InlineValidator;
+use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
+use Symfony\Component\DependencyInjection\Loader\Configurator\ReferenceConfigurator;
+
+return static function (ContainerConfigurator $containerConfigurator): void {
+ // Use "service" function for creating references to services when dropping support for Symfony 4.4
+ // Use "param" function for creating references to parameters when dropping support for Symfony 5.1
+ $containerConfigurator->services()
+
+ ->set('sonata.admin.validator.inline', InlineValidator::class)
+ ->public()
+ ->tag('validator.constraint_validator', ['alias' => 'sonata.admin.validator.inline'])
+ ->args([
+ new ReferenceConfigurator('service_container'),
+ new ReferenceConfigurator('validator.validator_factory'),
+ ])
+ ;
+};
diff --git a/src/Resources/config/validator.xml b/src/Resources/config/validator.xml
deleted file mode 100644
index 67363571f6c..00000000000
--- a/src/Resources/config/validator.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-