Skip to content
This repository has been archived by the owner on Sep 30, 2021. It is now read-only.

Commit

Permalink
Add SonataFormBundle bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
wbloszyk committed May 21, 2020
1 parent 1de6269 commit f861cd2
Show file tree
Hide file tree
Showing 44 changed files with 1,496 additions and 104 deletions.
26 changes: 12 additions & 14 deletions src/CoreBundle/DependencyInjection/SonataCoreExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,20 @@ public function load(array $configs, ContainerBuilder $container)
}

$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('date.xml');
$loader->load('commands.xml');
$loader->load('core.xml');
$loader->load('core_form_types.xml');
$loader->load('core_date.xml');
$loader->load('flash.xml');
$loader->load('form_types.xml');
$loader->load('validator.xml');
$loader->load('twig.xml');
$loader->load('model_adapter.xml');
$loader->load('core.xml');
$loader->load('commands.xml');
$loader->load('twig.xml');
$loader->load('core_validator.xml');

if (!isset($bundles['SonataFormBundle'])) {
$loader->load('form_types.xml');
$loader->load('date.xml');
$loader->load('validator.xml');
}

$this->registerFlashTypes($container, $config);
$container->setParameter('sonata.core.form_type', $config['form_type']);
Expand All @@ -109,8 +115,6 @@ public function load(array $configs, ContainerBuilder $container)
$this->configureClassesToCompile();
}

$this->deprecateSlugify($container);

$this->configureSerializerFormats($config);
}

Expand Down Expand Up @@ -203,10 +207,4 @@ public function configureSerializerFormats($config)
BaseSerializerHandler::setFormats($config['serializer']['formats']);
}
}

protected function deprecateSlugify(ContainerBuilder $container)
{
$container->getDefinition('sonata.core.slugify.cocur')->setDeprecated(true);
$container->getDefinition('sonata.core.slugify.native')->setDeprecated(true);
}
}
8 changes: 8 additions & 0 deletions src/CoreBundle/Resources/config/core_date.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="sonata.core.date.moment_format_converter" alias="sonata.form.date.moment_format_converter">
<deprecated>The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "%alias_id%" instead.</deprecated>
</service>
</services>
</container>
97 changes: 97 additions & 0 deletions src/CoreBundle/Resources/config/core_form_types.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="sonata.core.form.type.array_legacy" class="Sonata\CoreBundle\Form\Type\ImmutableArrayType" public="true">
<deprecated>The "%service_id%" service is deprecated since 3.x and will be removed in 4.0. Use "sonata.form.type.array" instead.</deprecated>
<tag name="form.type" alias="sonata_type_immutable_array_legacy"/>
</service>
<service id="sonata.core.form.type.boolean_legacy" class="Sonata\CoreBundle\Form\Type\BooleanType" public="true">
<deprecated>The "%service_id%" service is deprecated since 3.x and will be removed in 4.0. Use "sonata.form.type.boolean" instead.</deprecated>
<tag name="form.type" alias="sonata_type_boolean_legacy"/>
</service>
<service id="sonata.core.form.type.collection_legacy" class="Sonata\CoreBundle\Form\Type\CollectionType" public="true">
<deprecated>The "%service_id%" service is deprecated since 3.x and will be removed in 4.0. Use "sonata.form.type.collection" instead.</deprecated>
<tag name="form.type" alias="sonata_type_collection_legacy"/>
</service>
<service id="sonata.core.form.type.translatable_choice" class="Sonata\CoreBundle\Form\Type\TranslatableChoiceType" public="true">
<deprecated>The "%service_id%" service is deprecated since 2.2.0 and will be removed in 4.0.</deprecated>
<tag name="form.type" alias="sonata_type_translatable_choice"/>
<argument type="service" id="translator"/>
</service>
<service id="sonata.core.form.type.date_range_legacy" class="Sonata\CoreBundle\Form\Type\DateRangeType" public="true">
<deprecated>The "%service_id%" service is deprecated since 3.x and will be removed in 4.0. Use "sonata.form.type.date_range" instead.</deprecated>
<tag name="form.type" alias="sonata_type_date_range_legacy"/>
<argument type="service" id="translator"/>
</service>
<service id="sonata.core.form.type.datetime_range_legacy" class="Sonata\CoreBundle\Form\Type\DateTimeRangeType" public="true">
<deprecated>The "%service_id%" service is deprecated since 3.x and will be removed in 4.0. Use "sonata.form.type.datetime_range" instead.</deprecated>
<tag name="form.type" alias="sonata_type_datetime_range_legacy"/>
<argument type="service" id="translator"/>
</service>
<service id="sonata.core.form.type.date_picker_legacy" class="Sonata\CoreBundle\Form\Type\DatePickerType" public="true">
<deprecated>The "%service_id%" service is deprecated since 3.x and will be removed in 4.0. Use "sonata.form.type.date_picker" instead.</deprecated>
<tag name="form.type" alias="sonata_type_date_picker_legacy"/>
<argument type="service" id="sonata.core.date.moment_format_converter"/>
<argument type="service" id="translator"/>
</service>
<service id="sonata.core.form.type.datetime_picker_legacy" class="Sonata\CoreBundle\Form\Type\DateTimePickerType" public="true">
<deprecated>The "%service_id%" service is deprecated since 3.x and will be removed in 4.0. Use "sonata.form.type.datetime_picker" instead.</deprecated>
<tag name="form.type" alias="sonata_type_datetime_picker_legacy"/>
<argument type="service" id="sonata.core.date.moment_format_converter"/>
<argument type="service" id="translator"/>
</service>
<service id="sonata.core.form.type.date_range_picker_legacy" class="Sonata\CoreBundle\Form\Type\DateRangePickerType" public="true">
<deprecated>The "%service_id%" service is deprecated since 3.x and will be removed in 4.0. Use "sonata.form.type.date_range_picker" instead.</deprecated>
<tag name="form.type" alias="sonata_type_date_range_picker_legacy"/>
<argument type="service" id="translator"/>
</service>
<service id="sonata.core.form.type.datetime_range_picker_legacy" class="Sonata\CoreBundle\Form\Type\DateTimeRangePickerType" public="true">
<deprecated>The "%service_id%" service is deprecated since 3.x and will be removed in 4.0. Use "sonata.form.type.datetime_range_picker" instead.</deprecated>
<tag name="form.type" alias="sonata_type_datetime_range_picker_legacy"/>
<argument type="service" id="translator"/>
</service>
<service id="sonata.core.form.type.equal_legacy" class="Sonata\CoreBundle\Form\Type\EqualType" public="true">
<deprecated>The "%service_id%" service is deprecated since 3.x and will be removed in 4.0. Use "sonata.form.type.equal" instead.</deprecated>
<tag name="form.type" alias="sonata_type_equal_legacy"/>
<argument type="service" id="translator"/>
</service>
<service id="sonata.core.form.type.color_selector" class="Sonata\CoreBundle\Form\Type\ColorSelectorType" public="true">
<deprecated>The "%service_id%" service is deprecated since 3.5 and will be removed in 4.0.</deprecated>
<tag name="form.type" alias="sonata_type_color_selector"/>
</service>
<service id="sonata.core.form.type.color_legacy" class="Sonata\CoreBundle\Form\Type\ColorType" public="true">
<deprecated>The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0.</deprecated>
<tag name="form.type" alias="sonata_type_color"/>
</service>
<service id="sonata.core.form.type.array" alias="sonata.form.type.array" public="true">
<deprecated>The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "%alias_id%" instead.</deprecated>
</service>
<service id="sonata.core.form.type.boolean" alias="sonata.form.type.boolean" public="true">
<deprecated>The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "%alias_id%" instead.</deprecated>
</service>
<service id="sonata.core.form.type.collection" alias="sonata.form.type.collection" public="true">
<deprecated>The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "%alias_id%" instead.</deprecated>
</service>
<service id="sonata.core.form.type.date_range" alias="sonata.form.type.date_range" public="true">
<deprecated>The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "%alias_id%" instead.</deprecated>
</service>
<service id="sonata.core.form.type.datetime_range" alias="sonata.form.type.datetime_range" public="true">
<deprecated>The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "%alias_id%" instead.</deprecated>
</service>
<service id="sonata.core.form.type.date_picker" alias="sonata.form.type.date_picker" public="true">
<deprecated>The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "%alias_id%" instead.</deprecated>
</service>
<service id="sonata.core.form.type.datetime_picker" alias="sonata.form.type.datetime_picker" public="true">
<deprecated>The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "%alias_id%" instead.</deprecated>
</service>
<service id="sonata.core.form.type.date_range_picker" alias="sonata.form.type.date_range_picker" public="true">
<deprecated>The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "%alias_id%" instead.</deprecated>
</service>
<service id="sonata.core.form.type.datetime_range_picker" alias="sonata.form.type.datetime_range_picker" public="true">
<deprecated>The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "%alias_id%" instead.</deprecated>
</service>
<service id="sonata.core.form.type.equal" class="sonata.form.type.equal" public="true">
<deprecated>The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "%alias_id%" instead.</deprecated>
</service>
</services>
</container>
11 changes: 11 additions & 0 deletions src/CoreBundle/Resources/config/core_validator.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="sonata.core.validator.inline" class="Sonata\Form\Validator\InlineValidator">
<deprecated>The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "sonata.form.validator.inline" instead.</deprecated>
<argument type="service" id="service_container"/>
<argument type="service" id="validator.validator_factory"/>
<tag name="validator.constraint_validator" alias="sonata.core.validator.inline"/>
</service>
</services>
</container>
4 changes: 1 addition & 3 deletions src/CoreBundle/Resources/config/date.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="sonata.core.date.moment_format_converter" class="Sonata\Form\Date\MomentFormatConverter">
<deprecated>The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "sonata.form.date.moment_format_converter" instead.</deprecated>
</service>
<service id="sonata.form.date.moment_format_converter" class="Sonata\Form\Date\MomentFormatConverter"/>
</services>
</container>
Loading

0 comments on commit f861cd2

Please sign in to comment.