Skip to content

Commit

Permalink
bug #762 Remove Component namespace on state (loic425)
Browse files Browse the repository at this point in the history
This PR was merged into the 1.11 branch.

Discussion
----------

| Q               | A
| --------------- | -----
| Bug fix?        | no
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | 
| License         | MIT


Commits
-------

395d821 Remove Component namespace on state
b5d040a Fix DI
d74db52 Fix Phpspec tests
2040d33 Add missing test on responder
  • Loading branch information
lchrusciel authored Oct 31, 2023
2 parents 40eb1d4 + 2040d33 commit 7ec3b8a
Show file tree
Hide file tree
Showing 47 changed files with 97 additions and 77 deletions.
2 changes: 1 addition & 1 deletion docs/processors.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace App\Sylius\State\Processor;

use Sylius\Component\Customer\Model\CustomerInterface;
use Sylius\Resource\Doctrine\Common\State\PersistProcessor;
use Sylius\Component\Resource\State\ProcessorInterface;
use Sylius\Resource\State\ProcessorInterface;

final class CreateCustomerProcessor implements ProcessorInterface
{
Expand Down
2 changes: 2 additions & 0 deletions docs/providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ declare(strict_types=1);

namespace App\BoardGameBlog\Infrastructure\Sylius\State\Provider;

use Sylius\Resource\State\ProviderInterface;

final class BoardGameItemProvider implements ProviderInterface
{
public function __construct(
Expand Down
6 changes: 3 additions & 3 deletions src/Bundle/DependencyInjection/SyliusResourceExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
use Sylius\Component\Resource\Metadata\Metadata;
use Sylius\Component\Resource\Metadata\ResourceMetadata;
use Sylius\Component\Resource\Reflection\ClassReflection;
use Sylius\Component\Resource\State\ProcessorInterface;
use Sylius\Component\Resource\State\ProviderInterface;
use Sylius\Component\Resource\State\ResponderInterface;
use Sylius\Component\Resource\Twig\Context\Factory\ContextFactoryInterface;
use Sylius\Resource\State\ProcessorInterface;
use Sylius\Resource\State\ProviderInterface;
use Sylius\Resource\State\ResponderInterface;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
Expand Down
26 changes: 13 additions & 13 deletions src/Bundle/Resources/config/services/state.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,41 +23,41 @@
<service id="Sylius\Component\Resource\Factory\ArgumentParserInterface" alias="sylius.resource_factory.argument_parser" />

<service id="sylius.state.provider.event_dispatcher"
class="Sylius\Component\Resource\State\EventDispatcherProvider"
class="Sylius\Resource\State\Provider\EventDispatcherProvider"
decorates="sylius.state.provider"
decoration-priority="-32"
>
<argument type="service" id=".inner" />
<argument type="service" id="sylius.dispatcher.operation" />
</service>

<service id="sylius.state.provider" class="Sylius\Component\Resource\State\Provider">
<service id="sylius.state.provider" class="Sylius\Resource\State\Provider">
<argument type="tagged_locator" tag="sylius.state_provider" />
</service>
<service id="Sylius\Component\Resource\State\ProviderInterface" alias="sylius.state.provider" />
<service id="Sylius\Resource\State\ProviderInterface" alias="sylius.state.provider" />

<service id="sylius.state.provider.event_dispatcher"
class="Sylius\Component\Resource\State\EventDispatcherProvider"
class="Sylius\Resource\State\Provider\EventDispatcherProvider"
decorates="sylius.state.provider"
decoration-priority="-32"
>
<argument type="service" id=".inner" />
<argument type="service" id="sylius.dispatcher.operation" />
</service>

<service id="sylius.state.factory" class="Sylius\Component\Resource\State\Factory">
<service id="sylius.state.factory" class="Sylius\Resource\State\Factory">
<argument type="tagged_locator" tag="sylius.resource_factory" />
<argument type="service" id="sylius.expression_language.argument_parser.factory" />
</service>
<service id="Sylius\Component\Resource\State\FactoryInterface" alias="sylius.state.factory" />
<service id="Sylius\Resource\State\FactoryInterface" alias="sylius.state.factory" />

<service id="sylius.state.processor" class="Sylius\Component\Resource\State\Processor">
<service id="sylius.state.processor" class="Sylius\Resource\State\Processor">
<argument type="tagged_locator" tag="sylius.state_processor" />
</service>
<service id="Sylius\Component\Resource\State\ProcessorInterface" alias="sylius.state.processor" />
<service id="Sylius\Resource\State\ProcessorInterface" alias="sylius.state.processor" />

<service id="sylius.state.processor.event_dispatcher"
class="Sylius\Component\Resource\State\EventDispatcherProcessor"
class="Sylius\Resource\State\Processor\EventDispatcherProcessor"
decorates="sylius.state.processor"
decoration-priority="-32"
>
Expand All @@ -67,26 +67,26 @@
</service>

<service id="sylius.state.processor.bulk_aware"
class="Sylius\Component\Resource\State\BulkAwareProcessor"
class="Sylius\Resource\State\Processor\BulkAwareProcessor"
decorates="sylius.state.processor"
decoration-priority="-64"
>
<argument type="service" id=".inner" />
</service>

<service id="sylius.state.processor.event_dispatcher_bulk_aware"
class="Sylius\Component\Resource\State\EventDispatcherBulkAwareProcessor"
class="Sylius\Resource\State\Processor\EventDispatcherBulkAwareProcessor"
decorates="sylius.state.processor.bulk_aware"
decoration-priority="-32"
>
<argument type="service" id=".inner" />
<argument type="service" id="sylius.dispatcher.operation" />
</service>

<service id="sylius.state.responder" class="Sylius\Component\Resource\State\Responder">
<service id="sylius.state.responder" class="Sylius\Resource\State\Responder">
<argument type="tagged_locator" tag="sylius.state_responder" />
</service>
<service id="Sylius\Component\Resource\State\ResponderInterface" alias="sylius.state.responder" />
<service id="Sylius\Resource\State\ResponderInterface" alias="sylius.state.responder" />

<service id="Sylius\Component\Resource\Symfony\Request\State\Provider">
<argument type="tagged_locator" tag="sylius.repository" />
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Grid/State/RequestGridProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
use Sylius\Component\Resource\Grid\View\Factory\GridViewFactoryInterface;
use Sylius\Component\Resource\Metadata\GridAwareOperationInterface;
use Sylius\Component\Resource\Metadata\Operation;
use Sylius\Component\Resource\State\ProviderInterface;
use Sylius\Resource\Context\Context;
use Sylius\Resource\Context\Option\RequestOption;
use Sylius\Resource\State\ProviderInterface;

final class RequestGridProvider implements ProviderInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
namespace Sylius\Component\Resource\StateMachine\State;

use Sylius\Component\Resource\Metadata\Operation;
use Sylius\Component\Resource\State\ProcessorInterface;
use Sylius\Component\Resource\StateMachine\OperationStateMachineInterface;
use Sylius\Resource\Context\Context;
use Sylius\Resource\State\ProcessorInterface;

final class ApplyStateMachineTransitionProcessor implements ProcessorInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Symfony/EventListener/FactoryListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
use Sylius\Component\Resource\Metadata\FactoryAwareOperationInterface;
use Sylius\Component\Resource\Metadata\Operation;
use Sylius\Component\Resource\Metadata\Operation\HttpOperationInitiatorInterface;
use Sylius\Component\Resource\State\FactoryInterface;
use Sylius\Resource\Context\Initiator\RequestContextInitiatorInterface;
use Sylius\Resource\State\FactoryInterface;
use Symfony\Component\HttpKernel\Event\RequestEvent;

final class FactoryListener
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Symfony/EventListener/ReadListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

use Sylius\Component\Resource\Metadata\CreateOperationInterface;
use Sylius\Component\Resource\Metadata\Operation\HttpOperationInitiatorInterface;
use Sylius\Component\Resource\State\ProviderInterface;
use Sylius\Resource\Context\Initiator\RequestContextInitiatorInterface;
use Sylius\Resource\State\ProviderInterface;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

Expand Down
2 changes: 1 addition & 1 deletion src/Component/Symfony/EventListener/RespondListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
namespace Sylius\Component\Resource\Symfony\EventListener;

use Sylius\Component\Resource\Metadata\Operation\HttpOperationInitiatorInterface;
use Sylius\Component\Resource\State\ResponderInterface;
use Sylius\Resource\Context\Initiator\RequestContextInitiatorInterface;
use Sylius\Resource\State\ResponderInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\ViewEvent;
use Webmozart\Assert\Assert;
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Symfony/EventListener/WriteListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
namespace Sylius\Component\Resource\Symfony\EventListener;

use Sylius\Component\Resource\Metadata\Operation\HttpOperationInitiatorInterface;
use Sylius\Component\Resource\State\ProcessorInterface;
use Sylius\Resource\Context\Initiator\RequestContextInitiatorInterface;
use Sylius\Resource\State\ProcessorInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\ViewEvent;

Expand Down
2 changes: 1 addition & 1 deletion src/Component/Symfony/Request/State/ApiResponder.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
use Sylius\Component\Resource\Metadata\DeleteOperationInterface;
use Sylius\Component\Resource\Metadata\Operation;
use Sylius\Component\Resource\Metadata\UpdateOperationInterface;
use Sylius\Component\Resource\State\ResponderInterface;
use Sylius\Component\Resource\Symfony\Response\HeadersInitiatorInterface;
use Sylius\Resource\Context\Context;
use Sylius\Resource\Context\Option\RequestOption;
use Sylius\Resource\State\ResponderInterface;
use Symfony\Component\HttpFoundation\Response;
use Webmozart\Assert\Assert;

Expand Down
2 changes: 1 addition & 1 deletion src/Component/Symfony/Request/State/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
use Sylius\Component\Resource\Metadata\CollectionOperationInterface;
use Sylius\Component\Resource\Metadata\Operation;
use Sylius\Component\Resource\Reflection\CallableReflection;
use Sylius\Component\Resource\State\ProviderInterface;
use Sylius\Component\Resource\Symfony\ExpressionLanguage\ArgumentParserInterface;
use Sylius\Component\Resource\Symfony\Request\RepositoryArgumentResolver;
use Sylius\Resource\Context\Context;
use Sylius\Resource\Context\Option\RequestOption;
use Sylius\Resource\State\ProviderInterface;

final class Provider implements ProviderInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Symfony/Request/State/Responder.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

use Psr\Container\ContainerInterface;
use Sylius\Component\Resource\Metadata\Operation;
use Sylius\Component\Resource\State\ResponderInterface;
use Sylius\Resource\Context\Context;
use Sylius\Resource\Context\Option\RequestOption;
use Sylius\Resource\State\ResponderInterface;

final class Responder implements ResponderInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Symfony/Request/State/TwigResponder.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
use Sylius\Component\Resource\Metadata\HttpOperation;
use Sylius\Component\Resource\Metadata\Operation;
use Sylius\Component\Resource\Metadata\UpdateOperationInterface;
use Sylius\Component\Resource\State\ResponderInterface;
use Sylius\Component\Resource\Symfony\Routing\RedirectHandlerInterface;
use Sylius\Component\Resource\Twig\Context\Factory\ContextFactoryInterface;
use Sylius\Resource\Context\Context;
use Sylius\Resource\Context\Option\RequestOption;
use Sylius\Resource\State\ResponderInterface;
use Symfony\Component\HttpFoundation\Response;
use Twig\Environment;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@

use PhpSpec\ObjectBehavior;
use Sylius\Component\Resource\Metadata\Create;
use Sylius\Component\Resource\State\ProcessorInterface;
use Sylius\Component\Resource\StateMachine\OperationStateMachineInterface;
use Sylius\Component\Resource\StateMachine\State\ApplyStateMachineTransitionProcessor;
use Sylius\Resource\Context\Context;
use Sylius\Resource\State\ProcessorInterface;

final class ApplyStateMachineTransitionProcessorSpec extends ObjectBehavior
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
use Sylius\Component\Resource\Metadata\Create;
use Sylius\Component\Resource\Metadata\Operation\HttpOperationInitiatorInterface;
use Sylius\Component\Resource\Metadata\Update;
use Sylius\Component\Resource\State\FactoryInterface;
use Sylius\Component\Resource\Symfony\EventListener\FactoryListener;
use Sylius\Resource\Context\Context;
use Sylius\Resource\Context\Initiator\RequestContextInitiatorInterface;
use Sylius\Resource\State\FactoryInterface;
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\RequestEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
use Sylius\Component\Resource\Metadata\HttpOperation;
use Sylius\Component\Resource\Metadata\Operation\HttpOperationInitiatorInterface;
use Sylius\Component\Resource\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface;
use Sylius\Component\Resource\State\ProviderInterface;
use Sylius\Component\Resource\Symfony\EventListener\ReadListener;
use Sylius\Resource\Context\Context;
use Sylius\Resource\Context\Initiator\RequestContextInitiatorInterface;
use Sylius\Resource\State\ProviderInterface;
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\RequestEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
use PhpSpec\ObjectBehavior;
use Sylius\Component\Resource\Metadata\HttpOperation;
use Sylius\Component\Resource\Metadata\Operation\HttpOperationInitiatorInterface;
use Sylius\Component\Resource\State\ResponderInterface;
use Sylius\Component\Resource\Symfony\EventListener\RespondListener;
use Sylius\Resource\Context\Context;
use Sylius\Resource\Context\Initiator\RequestContextInitiatorInterface;
use Sylius\Resource\State\ResponderInterface;
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
use Prophecy\Argument;
use Sylius\Component\Resource\Metadata\HttpOperation;
use Sylius\Component\Resource\Metadata\Operation\HttpOperationInitiatorInterface;
use Sylius\Component\Resource\State\ProcessorInterface;
use Sylius\Component\Resource\Symfony\EventListener\WriteListener;
use Sylius\Resource\Context\Context;
use Sylius\Resource\Context\Initiator\RequestContextInitiatorInterface;
use Sylius\Resource\State\ProcessorInterface;
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
Expand Down
2 changes: 1 addition & 1 deletion src/Component/spec/Symfony/Request/State/ResponderSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
use PhpSpec\ObjectBehavior;
use Psr\Container\ContainerInterface;
use Sylius\Component\Resource\Metadata\HttpOperation;
use Sylius\Component\Resource\State\ResponderInterface;
use Sylius\Component\Resource\Symfony\Request\State\Responder;
use Sylius\Resource\Context\Context;
use Sylius\Resource\Context\Option\RequestOption;
use Sylius\Resource\State\ResponderInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
use Doctrine\Persistence\ObjectManager as DoctrineObjectManager;
use Sylius\Component\Resource\Metadata\Operation;
use Sylius\Component\Resource\Reflection\ClassInfoTrait;
use Sylius\Component\Resource\State\ProcessorInterface;
use Sylius\Resource\Context\Context;
use Sylius\Resource\State\ProcessorInterface;

final class PersistProcessor implements ProcessorInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
use Doctrine\Persistence\ObjectManager as DoctrineObjectManager;
use Sylius\Component\Resource\Metadata\Operation;
use Sylius\Component\Resource\Reflection\ClassInfoTrait;
use Sylius\Component\Resource\State\ProcessorInterface;
use Sylius\Resource\Context\Context;
use Sylius\Resource\State\ProcessorInterface;

final class RemoveProcessor implements ProcessorInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace Sylius\Component\Resource\State;
namespace Sylius\Resource\State;

use Psr\Container\ContainerInterface;
use Sylius\Component\Resource\Factory\FactoryInterface as ResourceFactoryInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace Sylius\Component\Resource\State;
namespace Sylius\Resource\State;

use Sylius\Component\Resource\Metadata\Operation;
use Sylius\Resource\Context\Context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace Sylius\Component\Resource\State;
namespace Sylius\Resource\State;

use Psr\Container\ContainerInterface;
use Sylius\Component\Resource\Metadata\Operation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@

declare(strict_types=1);

namespace Sylius\Component\Resource\State;
namespace Sylius\Resource\State\Processor;

use Sylius\Component\Resource\Metadata\BulkOperationInterface;
use Sylius\Component\Resource\Metadata\Operation;
use Sylius\Resource\Context\Context;
use Sylius\Resource\State\ProcessorInterface;

/**
* @experimental
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@

declare(strict_types=1);

namespace Sylius\Component\Resource\State;
namespace Sylius\Resource\State\Processor;

use Sylius\Component\Resource\Metadata\BulkOperationInterface;
use Sylius\Component\Resource\Metadata\Operation;
use Sylius\Component\Resource\Symfony\EventDispatcher\OperationEventDispatcherInterface;
use Sylius\Resource\Context\Context;
use Sylius\Resource\State\ProcessorInterface;

/**
* @experimental
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@

declare(strict_types=1);

namespace Sylius\Component\Resource\State;
namespace Sylius\Resource\State\Processor;

use Sylius\Component\Resource\Metadata\CreateOperationInterface;
use Sylius\Component\Resource\Metadata\Operation;
use Sylius\Component\Resource\ResourceActions;
use Sylius\Component\Resource\Symfony\EventDispatcher\OperationEventDispatcherInterface;
use Sylius\Component\Resource\Symfony\EventDispatcher\OperationEventHandlerInterface;
use Sylius\Resource\Context\Context;
use Sylius\Resource\State\ProcessorInterface;

/**
* @experimental
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace Sylius\Component\Resource\State;
namespace Sylius\Resource\State;

use Sylius\Component\Resource\Metadata\Operation;
use Sylius\Resource\Context\Context;
Expand Down
Loading

0 comments on commit 7ec3b8a

Please sign in to comment.