mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
[CoreBundle] Remove the CancelOrderStateMachineCallbackPass class and related code
This commit is contained in:
parent
b7d49a7c00
commit
b5901e56fe
5 changed files with 0 additions and 155 deletions
1
ecs.php
1
ecs.php
|
|
@ -27,7 +27,6 @@ return static function (ECSConfig $config): void {
|
|||
InlineDocCommentDeclarationSniff::class . '.MissingVariable',
|
||||
InlineDocCommentDeclarationSniff::class . '.NoAssignment',
|
||||
VisibilityRequiredFixer::class => ['*Spec.php'],
|
||||
ErrorSuppressionFixer::class => 'src/Sylius/Bundle/CoreBundle/DependencyInjection/Compiler/BackwardsCompatibility/CancelOrderStateMachineCallbackPass.php',
|
||||
'**/var/*',
|
||||
'src/Sylius/Behat/Service/Converter/IriConverter.php',
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -2505,11 +2505,6 @@ parameters:
|
|||
count: 1
|
||||
path: src/Sylius/Bundle/CoreBundle/Controller/ProductTaxonController.php
|
||||
|
||||
-
|
||||
message: "#^PHPDoc tag @var for variable \\$smConfigs has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: src/Sylius/Bundle/CoreBundle/DependencyInjection/Compiler/BackwardsCompatibility/CancelOrderStateMachineCallbackPass.php
|
||||
|
||||
-
|
||||
message: "#^Method Sylius\\\\Bundle\\\\CoreBundle\\\\DependencyInjection\\\\SyliusCoreExtension\\:\\:getNamespacesOfMigrationsExecutedBefore\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
|
|
|
|||
|
|
@ -1,44 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Sylius Sp. z o.o.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Sylius\Bundle\CoreBundle\DependencyInjection\Compiler\BackwardsCompatibility;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
final class CancelOrderStateMachineCallbackPass implements CompilerPassInterface
|
||||
{
|
||||
public function process(ContainerBuilder $container): void
|
||||
{
|
||||
if (!$container->hasParameter('sm.configs')) {
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var array $smConfigs */
|
||||
$smConfigs = $container->getParameter('sm.configs');
|
||||
|
||||
if (isset($smConfigs['sylius_order']['callbacks']['after']['sylis_cancel_order'])) {
|
||||
trigger_deprecation(
|
||||
'sylius/core-bundle',
|
||||
'1.11',
|
||||
'Callback "%s" was renamed to "%s". The old name will be removed in Sylius 2.0, use the new name to override it.',
|
||||
'winzou_state_machine.sylius_order.callbacks.after.sylis_cancel_order',
|
||||
'winzou_state_machine.sylius_order.callbacks.after.sylius_cancel_order',
|
||||
);
|
||||
|
||||
$smConfigs['sylius_order']['callbacks']['after']['sylius_cancel_order'] = $smConfigs['sylius_order']['callbacks']['after']['sylis_cancel_order'];
|
||||
unset($smConfigs['sylius_order']['callbacks']['after']['sylis_cancel_order']);
|
||||
$container->setParameter('sm.configs', $smConfigs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -21,7 +21,6 @@ use Doctrine\Inflector\Rules\Substitutions;
|
|||
use Doctrine\Inflector\Rules\Transformations;
|
||||
use Doctrine\Inflector\Rules\Word;
|
||||
use Doctrine\ORM\Query;
|
||||
use Sylius\Bundle\CoreBundle\DependencyInjection\Compiler\BackwardsCompatibility\CancelOrderStateMachineCallbackPass;
|
||||
use Sylius\Bundle\CoreBundle\DependencyInjection\Compiler\BackwardsCompatibility\ResolveShopUserTargetEntityPass;
|
||||
use Sylius\Bundle\CoreBundle\DependencyInjection\Compiler\BackwardsCompatibility\Symfony5AuthenticationManagerPass;
|
||||
use Sylius\Bundle\CoreBundle\DependencyInjection\Compiler\BackwardsCompatibility\Symfony6PrivateServicesPass;
|
||||
|
|
@ -93,7 +92,6 @@ final class SyliusCoreBundle extends AbstractResourceBundle
|
|||
$container->addCompilerPass(new Symfony5AuthenticationManagerPass());
|
||||
$container->addCompilerPass(new Symfony6PrivateServicesPass());
|
||||
$container->addCompilerPass(new TranslatableEntityLocalePass());
|
||||
$container->addCompilerPass(new CancelOrderStateMachineCallbackPass());
|
||||
$container->addCompilerPass(new SyliusPriceHistoryLegacyAliasesPass());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,103 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Sylius Sp. z o.o.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Sylius\Bundle\CoreBundle\Tests\DependencyInjection\Compiler\BackwardsCompatibility;
|
||||
|
||||
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractCompilerPassTestCase;
|
||||
use Sylius\Bundle\CoreBundle\DependencyInjection\Compiler\BackwardsCompatibility\CancelOrderStateMachineCallbackPass;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
class CancelOrderStateMachineCallbackPassTest extends AbstractCompilerPassTestCase
|
||||
{
|
||||
public array $smConfigs = [
|
||||
'sylius_order' => [
|
||||
'class' => 'Sylius\\Component\\Core\\Model\\Order',
|
||||
'property_path' => 'state',
|
||||
'graph' => 'sylius_order',
|
||||
'state_machine_class' => 'Sylius\\Component\\Resource\\StateMachine\\StateMachine',
|
||||
'states' => [
|
||||
'cart',
|
||||
'new',
|
||||
'cancelled',
|
||||
'fulfilled',
|
||||
],
|
||||
'transitions' => [
|
||||
'create' => [
|
||||
'from' => [
|
||||
'cart',
|
||||
],
|
||||
'to' => 'new',
|
||||
],
|
||||
'cancel' => [
|
||||
'from' => [
|
||||
'new',
|
||||
],
|
||||
'to' => 'cancelled',
|
||||
],
|
||||
'fulfill' => [
|
||||
'from' => [
|
||||
'new',
|
||||
],
|
||||
'to' => 'fulfilled',
|
||||
],
|
||||
],
|
||||
'callbacks' => [
|
||||
'before' => [],
|
||||
'after' => [
|
||||
'sylis_cancel_order' => [
|
||||
'on' => [
|
||||
'cancel',
|
||||
],
|
||||
'do' => [
|
||||
'@sylius.inventory.order_inventory_operator',
|
||||
'cancel',
|
||||
],
|
||||
'args' => [
|
||||
'object',
|
||||
],
|
||||
'disabled' => false,
|
||||
'priority' => 0,
|
||||
],
|
||||
],
|
||||
'guard' => [],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
/** @test */
|
||||
public function it_converts_from_old_name_to_new_name(): void
|
||||
{
|
||||
$this->setParameter('sm.configs', $this->smConfigs);
|
||||
$this->compile();
|
||||
|
||||
$smConfigs = $this->container->getParameter('sm.configs');
|
||||
$this->assertFalse(
|
||||
isset($smConfigs['sylius_order']['callbacks']['after']['sylis_cancel_order']),
|
||||
'State machine "sylius_order" should not have "sylis_cancel_order" callback configured.',
|
||||
);
|
||||
$this->assertTrue(
|
||||
isset($smConfigs['sylius_order']['callbacks']['after']['sylius_cancel_order']),
|
||||
'State machine "sylius_order" should have "sylius_cancel_order" callback configured.',
|
||||
);
|
||||
$this->assertEquals(
|
||||
$this->smConfigs['sylius_order']['callbacks']['after']['sylis_cancel_order'],
|
||||
$smConfigs['sylius_order']['callbacks']['after']['sylius_cancel_order'],
|
||||
'State machine "sylius_order" should have the "sylis_cancel_order" callback moved to "sylius_cancel_order".',
|
||||
);
|
||||
}
|
||||
|
||||
protected function registerCompilerPass(ContainerBuilder $container): void
|
||||
{
|
||||
$container->addCompilerPass(new CancelOrderStateMachineCallbackPass());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue