-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle][Workflow] Add a way to enable the AuditTrail Logger #21933
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,6 @@ | |
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer; | ||
use Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer; | ||
use Symfony\Component\Workflow; | ||
use Symfony\Component\Workflow\SupportStrategy\ClassInstanceSupportStrategy; | ||
use Symfony\Component\Console\Application; | ||
|
||
/** | ||
|
@@ -480,13 +479,24 @@ private function registerWorkflowConfiguration(array $workflows, ContainerBuilde | |
// Add workflow to Registry | ||
if ($workflow['supports']) { | ||
foreach ($workflow['supports'] as $supportedClassName) { | ||
$strategyDefinition = new Definition(ClassInstanceSupportStrategy::class, array($supportedClassName)); | ||
$strategyDefinition = new Definition(Workflow\SupportStrategy\ClassInstanceSupportStrategy::class, array($supportedClassName)); | ||
$strategyDefinition->setPublic(false); | ||
$registryDefinition->addMethodCall('add', array(new Reference($workflowId), $strategyDefinition)); | ||
} | ||
} elseif (isset($workflow['support_strategy'])) { | ||
$registryDefinition->addMethodCall('add', array(new Reference($workflowId), new Reference($workflow['support_strategy']))); | ||
} | ||
|
||
// Enable the AuditTrail | ||
if ($workflow['audit_trail']['enabled']) { | ||
$listener = new Definition(Workflow\EventListener\AuditTrailListener::class); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right now, there are more usage of "this style" than FQCN There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just saw that, in the Workflow namespace in fact. OK then. |
||
$listener->addTag('monolog.logger', array('channel' => 'workflow')); | ||
$listener->addTag('kernel.event_listener', array('event' => sprintf('workflow.%s.leave', $name), 'method' => 'onLeave')); | ||
$listener->addTag('kernel.event_listener', array('event' => sprintf('workflow.%s.transition', $name), 'method' => 'onTransition')); | ||
$listener->addTag('kernel.event_listener', array('event' => sprintf('workflow.%s.enter', $name), 'method' => 'onEnter')); | ||
$listener->addArgument(new Reference('logger')); | ||
$container->setDefinition(sprintf('%s.listener.audit_trail', $workflowId), $listener); | ||
} | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To reduce the number of
use
statement and to be consistant with other "...\Workflow" usage.