Skip to content

[FrameworkBundle][Workflow] Fix deprectation when checking workflow.registry service in dump command #24620

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
wants to merge 5 commits into from
Closed

[FrameworkBundle][Workflow] Fix deprectation when checking workflow.registry service in dump command #24620

wants to merge 5 commits into from

Conversation

Jean-Beru
Copy link
Contributor

@Jean-Beru Jean-Beru commented Oct 19, 2017

Q A
Branch? 3.4
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT
Doc PR

This PR will declare workflow.registry as a public service to avoid deprecation when WorkflowDumpCommand checks its existence. It only concerns 3.4 since this isEnabled method will be removed in 4.0.

@stof
Copy link
Member

stof commented Oct 19, 2017

Well, forcing to keep the service as public just for the BC layer is bad, as it means that any people using the service in a public way would not be warned about that (and so we cannot make the service private at all in 4.0).

A better solution would be to improve the way the command gets disabled in 3.4.

@nicolas-grekas nicolas-grekas added this to the 3.4 milestone Oct 19, 2017
@@ -27,5 +27,9 @@
<service id="Symfony\Component\Workflow\Registry" alias="workflow.registry" />

<service id="workflow.security.expression_language" class="Symfony\Component\Workflow\EventListener\ExpressionLanguage" />

<service id="Symfony\Bundle\FrameworkBundle\Command\WorkflowDumpCommand">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moving this requires $container->removeDefinition(WorkflowDumpCommand::class); call to be updated, as console.xml is also conditionally loaded.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch ;-)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well it still needs to be removed if console is not available ;-) not sure about the current effect of this service without console available. I guess it doesnt hurt.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Argh! I think we can keep command definition in console.xml and remove it if workflow is disabled.

@Jean-Beru
Copy link
Contributor Author

Thanks for your feedback @stof. So, I moved command in the conditionnally loaded workflow.xml.

@Jean-Beru Jean-Beru changed the title [Workflow] Fix deprectation when checking workflow.registry service in dump command [FrameworkBundle][Workflow] Fix deprectation when checking workflow.registry service in dump command Oct 20, 2017
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(with minor comment)

@@ -624,7 +624,7 @@ private function registerProfilerConfiguration(array $config, ContainerBuilder $
private function registerWorkflowConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
{
if (!$config['enabled']) {
if (!class_exists(Workflow\Workflow::class)) {
if ($container->hasDefinition(WorkflowDumpCommand::class)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the "if" can be removed: removeDefinition already does it internally

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. Thks @nicolas-grekas !

@fabpot
Copy link
Member

fabpot commented Oct 20, 2017

Thank you @Jean-Beru.

@fabpot fabpot closed this Oct 20, 2017
fabpot added a commit that referenced this pull request Oct 20, 2017
… workflow.registry service in dump command (Jean-Beru)

This PR was squashed before being merged into the 3.4 branch (closes #24620).

Discussion
----------

[FrameworkBundle][Workflow] Fix deprectation when checking workflow.registry service in dump command

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md files -->
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

This PR will declare `workflow.registry` as a public service to avoid deprecation when `WorkflowDumpCommand` checks its existence. It only concerns 3.4 since this `isEnabled` method will be removed in 4.0.

Commits
-------

9e75847 [FrameworkBundle][Workflow] Fix deprectation when checking workflow.registry service in dump command
This was referenced Oct 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants