-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from FLUX-SE/symfony-workflow
Symfony workflow support
- Loading branch information
Showing
34 changed files
with
328 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace FluxSE\SyliusPayumStripePlugin\Abstraction\StateMachine; | ||
|
||
use Sylius\Abstraction\StateMachine\StateMachineInterface as SyliusAbstractionStateMachineInterface; | ||
|
||
final class CompositeStateMachine implements StateMachineInterface | ||
{ | ||
private SyliusAbstractionStateMachineInterface $stateMachine; | ||
|
||
public function __construct(SyliusAbstractionStateMachineInterface $stateMachine) | ||
{ | ||
$this->stateMachine = $stateMachine; | ||
} | ||
|
||
public function getTransitionToState(object $subject, string $graphName, string $toState): ?string | ||
{ | ||
return $this->stateMachine->getTransitionToState($subject, $graphName, $toState); | ||
} | ||
|
||
public function apply(object $subject, string $graphName, string $transition, array $context = []): void | ||
{ | ||
$this->stateMachine->apply($subject, $graphName, $transition, $context); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace FluxSE\SyliusPayumStripePlugin\Abstraction\StateMachine; | ||
|
||
interface StateMachineInterface | ||
{ | ||
public function getTransitionToState(object $subject, string $graphName, string $toState): ?string; | ||
|
||
public function apply(object $subject, string $graphName, string $transition, array $context = []): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace FluxSE\SyliusPayumStripePlugin\Abstraction\StateMachine; | ||
|
||
use SM\Factory\FactoryInterface; | ||
use Sylius\Component\Resource\StateMachine\StateMachine as SyliusStateMachineInterface; | ||
use Webmozart\Assert\Assert; | ||
|
||
final class WinzouStateMachine implements StateMachineInterface | ||
{ | ||
private FactoryInterface $factory; | ||
|
||
public function __construct(FactoryInterface $factory) | ||
{ | ||
$this->factory = $factory; | ||
} | ||
|
||
public function getTransitionToState(object $subject, string $graphName, string $toState): ?string | ||
{ | ||
$stateMachine = $this->factory->get($subject, $graphName); | ||
Assert::isInstanceOf($stateMachine, SyliusStateMachineInterface::class); | ||
|
||
return $stateMachine->getTransitionToState($toState); | ||
} | ||
|
||
public function apply(object $subject, string $graphName, string $transition, array $context = []): void | ||
{ | ||
$stateMachine = $this->factory->get($subject, $graphName); | ||
|
||
$stateMachine->apply($transition); | ||
} | ||
} |
Oops, something went wrong.