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

Commit

Permalink
Merge b89c7e3 into 65a57fe
Browse files Browse the repository at this point in the history
  • Loading branch information
wbloszyk committed May 22, 2020
2 parents 65a57fe + b89c7e3 commit 30050f6
Show file tree
Hide file tree
Showing 120 changed files with 3,191 additions and 320 deletions.
9 changes: 6 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"twig/twig": "^1.34 || ^2.0"
},
"conflict": {
"sonata-project/exporter": "< 1.11.0"
"sonata-project/exporter": "< 1.11"
},
"require-dev": {
"doctrine/orm": "^2.4",
Expand All @@ -48,8 +48,11 @@
"matthiasnoback/symfony-config-test": "^4.0",
"matthiasnoback/symfony-dependency-injection-test": "^4.0",
"nelmio/api-doc-bundle": "^2.11",
"sonata-project/exporter": "^1.11.0 || ^2.0",
"symfony/phpunit-bridge": "^4.3"
"phpspec/prophecy": "^1.0",
"sonata-project/exporter": "^1.11 || ^2.0",
"symfony/browser-kit": "4.3",
"symfony/phpunit-bridge": "^4.3",
"symfony/twig-bundle": "^4.3"
},
"suggest": {
"sonata-project/doctrine-extensions": "Direct replacement for Doctrine behavioral extensions",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

/**
* @author Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* @deprecated since sonata-project/core-bundle 3.x, to be removed in 4.0.
*/
class AdapterCompilerPass implements CompilerPassInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

/**
* @author Hugo Briand <briand@ekino.com>
*
* @deprecated since sonata-project/core-bundle 3.x, to be removed in 4.0.
*/
class StatusRendererCompilerPass implements CompilerPassInterface
{
Expand Down
2 changes: 2 additions & 0 deletions src/CoreBundle/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
*
* @author Thomas Rabaix <thomas.rabaix@sonata-project.org>
* @author Alexander <iam.asm89@gmail.com>
*
* @deprecated since sonata-project/core-bundle 3.x, to be removed in 4.0.
*/
class Configuration implements ConfigurationInterface
{
Expand Down
44 changes: 27 additions & 17 deletions src/CoreBundle/DependencyInjection/SonataCoreExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@

/**
* @author Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* @deprecated since sonata-project/core-bundle 3.x, to be removed in 4.0.
*/
class SonataCoreExtension extends Extension implements PrependExtensionInterface
{
Expand Down Expand Up @@ -90,14 +92,25 @@ public function load(array $configs, ContainerBuilder $container)
}

$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('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('core.xml');
$loader->load('core_form_types.xml');
$loader->load('core_date.xml');
$loader->load('core_flash.xml');
$loader->load('model_adapter.xml');
$loader->load('core_twig.xml');
$loader->load('core_validator.xml');

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

if (!isset($bundles['SonataTwigBundle'])) {
$loader->load('flash.xml');
$loader->load('twig.xml');
}

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

$this->deprecateSlugify($container);

$this->configureSerializerFormats($config);
}

Expand Down Expand Up @@ -183,9 +194,14 @@ public function registerFlashTypes(ContainerBuilder $container, array $config)
$cssClasses[$typeKey] = \array_key_exists('css_class', $typeConfig) ? $typeConfig['css_class'] : $typeKey;
}

$identifier = 'sonata.core.flashmessage.manager';
$identifier = 'sonata.twig.flashmessage.manager';

if ($container->has($identifier)) {
$definition = $container->getDefinition($identifier);
} else {
$definition = $container->getDefinition('sonata.core.flashmessage.manager');
}

$definition = $container->getDefinition($identifier);
$definition->replaceArgument(2, $types);
$definition->replaceArgument(3, $cssClasses);

Expand All @@ -201,10 +217,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);
}
}
2 changes: 2 additions & 0 deletions src/CoreBundle/Exporter/Exporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

/**
* NEXT_MAJOR: remove this class, and the dev dependency.
*
* @deprecated since sonata-project/core-bundle 3.x, to be removed in 4.0.
*/
class Exporter
{
Expand Down
44 changes: 13 additions & 31 deletions src/CoreBundle/Form/EventListener/FixCheckboxDataListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,42 +13,24 @@

namespace Sonata\CoreBundle\Form\EventListener;

use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
if (!class_exists(\Sonata\Form\EventListener\FixCheckboxDataListener::class, false)) {
@trigger_error(
'The '.__NAMESPACE__.'\FixCheckboxDataListener class is deprecated since version 3.13.0 and will be removed in 4.0.'
.' Use Sonata\Form\EventListener\FixCheckboxDataListener instead.',
E_USER_DEPRECATED
);
}

@trigger_error(
'The '.__NAMESPACE__.'\FixCheckboxDataListener class is deprecated since version 3.13.0 and will be removed in 4.0.'
.' Use Sonata\Form\EventListener\FixCheckboxDataListener instead.',
E_USER_DEPRECATED
class_alias(
\Sonata\Form\EventListener\FixCheckboxDataListener::class,
__NAMESPACE__.'\FixCheckboxDataListener'
);

/**
* @deprecated since sonata-project/core-bundle 3.13.0, to be removed in 4.0.
*/
class FixCheckboxDataListener extends \Sonata\Form\EventListener\FixCheckboxDataListener
{
public static function getSubscribedEvents()
{
return [FormEvents::PRE_SUBMIT => 'preBind'];
}

if (false) {
/**
* NEXT_MAJOR: remove this method.
*
* @deprecated since sonata-project/core-bundle 2.3, to be renamed in 4.0.
* Use {@link preSubmit} instead
* @deprecated since sonata-project/core-bundle 3.13.0, to be removed in 4.0.
*/
public function preBind(FormEvent $event)
class FixCheckboxDataListener extends \Sonata\Form\EventListener\FixCheckboxDataListener
{
// BC prevention for class extending this one.
if (self::class !== static::class) {
@trigger_error(
__METHOD__.' is deprecated since 2.3 and will be renamed in 4.0.'
.' Use '.__CLASS__.'::preSubmit instead.',
E_USER_DEPRECATED
);
}

$this->preSubmit($event);
}
}
68 changes: 13 additions & 55 deletions src/CoreBundle/Form/EventListener/ResizeFormListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,66 +13,24 @@

namespace Sonata\CoreBundle\Form\EventListener;

use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
if (!class_exists(\Sonata\Form\EventListener\ResizeFormListener::class, false)) {
@trigger_error(
'The '.__NAMESPACE__.'\ResizeFormListener class is deprecated since version 3.13.0 and will be removed in 4.0.'
.' Use Sonata\Form\EventListener\ResizeFormListener instead.',
E_USER_DEPRECATED
);
}

@trigger_error(
'The '.__NAMESPACE__.'\ResizeFormListener class is deprecated since version 3.13.0 and will be removed in 4.0.'
.' Use Sonata\Form\EventListener\ResizeFormListener instead.',
E_USER_DEPRECATED
class_alias(
\Sonata\Form\EventListener\ResizeFormListener::class,
__NAMESPACE__.'\ResizeFormListener'
);

/**
* @deprecated since sonata-project/core-bundle 3.13.0, to be removed in 4.0.
*/
class ResizeFormListener extends \Sonata\Form\EventListener\ResizeFormListener
{
public static function getSubscribedEvents()
{
return [
FormEvents::PRE_SET_DATA => 'preSetData',
FormEvents::PRE_SUBMIT => 'preBind',
FormEvents::SUBMIT => 'onBind',
];
}

/**
* NEXT_MAJOR: remove this method.
*
* @deprecated since sonata-project/core-bundle 2.3, to be renamed in 4.0.
* Use {@link preSubmit} instead
*/
public function preBind(FormEvent $event)
{
// BC prevention for class extending this one.
if (self::class !== static::class) {
@trigger_error(
__METHOD__.' method is deprecated since 2.3 and will be renamed in 4.0.'
.' Use '.__CLASS__.'::preSubmit instead.',
E_USER_DEPRECATED
);
}

$this->preSubmit($event);
}

if (false) {
/**
* NEXT_MAJOR: remove this method.
*
* @deprecated since sonata-project/core-bundle 2.3, to be removed in 4.0.
* Use {@link onSubmit} instead
* @deprecated since sonata-project/core-bundle 3.13.0, to be removed in 4.0.
*/
public function onBind(FormEvent $event)
class ResizeFormListener extends \Sonata\Form\EventListener\ResizeFormListener
{
// BC prevention for class extending this one.
if (self::class !== static::class) {
@trigger_error(
__METHOD__.' is deprecated since 2.3 and will be renamed in 4.0.'
.' Use '.__CLASS__.'::onSubmit instead.',
E_USER_DEPRECATED
);
}

$this->onSubmit($event);
}
}
3 changes: 3 additions & 0 deletions src/CoreBundle/Form/FormHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
use Symfony\Component\Form\FormTypeInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* @deprecated since sonata-project/core-bundle 3.x, to be removed in 4.0.
*/
class FormHelper
{
private static $typeMapping = [];
Expand Down
3 changes: 3 additions & 0 deletions src/CoreBundle/Model/PageableManagerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ class_alias(
);

if (false) {
/**
* @deprecated since sonata-project/core-bundle 3.x, to be removed in 4.0.
*/
interface PageableManagerInterface extends \Sonata\Doctrine\Model\PageableManagerInterface
{
}
Expand Down
2 changes: 2 additions & 0 deletions src/CoreBundle/Resources/config/commands.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
<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\CoreBundle\Command\SonataDumpDoctrineMetaCommand" class="Sonata\CoreBundle\Command\SonataDumpDoctrineMetaCommand">
<deprecated>The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0.</deprecated>
<tag name="console.command"/>
</service>
<service id="Sonata\CoreBundle\Command\SonataListFormMappingCommand" class="Sonata\CoreBundle\Command\SonataListFormMappingCommand">
<deprecated>The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0.</deprecated>
<tag name="console.command"/>
</service>
</services>
Expand Down
5 changes: 4 additions & 1 deletion src/CoreBundle/Resources/config/core.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<?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.slugify.cocur" class="Cocur\Slugify\Slugify" public="true"/>
<service id="sonata.core.slugify.cocur" class="Cocur\Slugify\Slugify" public="true">
<deprecated>The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0. Use "sonata.twig.slugify.cocur" instead.</deprecated>
</service>
<service id="sonata.core.slugify.native" class="Sonata\CoreBundle\Component\NativeSlugify" public="true">
<deprecated>The "%service_id%" service is deprecated since 2.3 and will be removed in 4.0.</deprecated>
</service>
<service id="sonata.core.form.extension.dependency" class="Sonata\CoreBundle\Form\Extension\DependencyInjectionExtension">
<deprecated>The "%service_id%" service is deprecated since sonata-project/core-bundle 3.x and will be removed in 4.0.</deprecated>
<argument type="service" id="service_container"/>
<argument type="collection"/>
<argument type="collection"/>
Expand Down
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>
14 changes: 14 additions & 0 deletions src/CoreBundle/Resources/config/core_flash.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?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.flashmessage.manager" alias="sonata.twig.flashmessage.manager" 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.flashmessage.twig.runtime" alias="sonata.twig.flashmessage.twig.runtime">
<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.flashmessage.twig.extension" alias="sonata.twig.flashmessage.twig.extension" 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>
Loading

0 comments on commit 30050f6

Please sign in to comment.