8000 [Workflow] Override guard listener class by ochretien · Pull Request #29751 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Workflow] Override guard listener class #29751

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[Workflow] Added configuration option along with parameter
  • Loading branch information
ochretien committed Jan 3, 2019
commit b72fc53bbab41ba9541c6a42393adea8b7f9013f
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,9 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode)
->arrayNode('audit_trail')
->canBeEnabled()
->end()
->scalarNode('guard_listener')
->cannotBeEmpty()
->end()
->enumNode('type')
->values(array('workflow', 'state_machine'))
->end()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,11 @@ private function registerWorkflowConfiguration(array $config, ContainerBuilder $
throw new LogicException('Cannot guard workflows as the Security component is not installed. Try running "composer require symfony/security".');
}

$guard = new Definition(Workflow\EventListener\GuardListener::class);
$guardListener = isset($workflow['guard_listener'])
? $workflow['guard_listener']
: $container->getParameter('workflow.guard_listener');

$guard = new Definition($guardListener);
$guard->setPrivate(true);

$guard->setArguments(array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
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">

<parameters>
<parameter key="workflow.guard_listener">Symfony\Component\Workflow\EventListener\GuardListener</parameter>
</parameters>

<services>
<defaults public="false" />

Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/Workflow/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ CHANGELOG
* Added guard `is_valid()` method support.
* Added support for `Event::getWorkflowName()` for "announce" events.
* Added `workflow.completed` events which are fired after a transition is completed.
* Added `guard_listener` configuration option along with `workflow.guard_listener` parameter.

3.3.0
-----
Expand Down
0