Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[FrameworkBundle][Workflow] Deprecate the default type of a workflow#22416

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@lyrixx
Copy link
Member

@lyrixxlyrixx commentedApr 13, 2017
edited by nicolas-grekas
Loading

QA
Branch?3.3
Bug fix?no
New feature?no
BC breaks?no
Deprecations?yes
Tests pass?yes
Fixed tickets-
LicenseMIT
Doc PR-

Before this patch, the default type is "workflow". Most of the time a
"state_machine" is better because it's simpler and it involves less
knowledge to be able to use it.

So this patch deprecate a missing type in Symfony 3.3. And In Symfony
4.0 the default value will become "state_machine".


* The "framework.trusted_proxies" configuration option and the corresponding "kernel.trusted_proxies" parameter have been deprecated and will be removed in 4.0. Use the Request::setTrustedProxies() method in your front controller instead.

* Not defining the "type" option of the "framework.workflows.*" configuration entry is deprecated.

Choose a reason for hiding this comment

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

of ``framework.workflows.*`` configuration entries


* The "framework.trusted_proxies" configuration option and the corresponding "kernel.trusted_proxies" parameter have been removed. Use the`Request::setTrustedProxies()` method in your front controller instead.

* The default value of the "framework.workflows.[name].type" configuration option is now "state_machine".

Choose a reason for hiding this comment

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

of ``framework.workflows.*.type`` configuration options

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Fixed. Thanks.

@lyrixxlyrixxforce-pushed theworkflow-default-type branch from619bcae to88300fbCompareApril 13, 2017 09:34
foreach ($workflowsas$name =>$workflow) {
if (!array_key_exists('type',$workflow)) {
$workflow['type'] ='workflow';
@trigger_error(sprintf('The "type" option of the "framework.workflows.%s" configuration entry must be defined since Symfony 3.3. The default value will be "state_machine" in Symfony 4.0.',$name),E_USER_DEPRECATED);
Copy link
Member

Choose a reason for hiding this comment

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

much better would be to put it in theConfiguration class:

  • use avalidate callback (on the workflow node) to trigger a deprecation and set the type when it is not set
  • switch to->isRequired() on the type node for Symfony 4 instead.

This would keep the deprecation warning in the same place than the new way of doing things in Symfony 4, making it easier to update the code

Copy link
Member

Choose a reason for hiding this comment

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

and we should have a legacy test covering the case of the default to ensure it does not break in 3.x

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

switch to ->isRequired() on the type node for Symfony 4 instead.

In symfony 4, The default value will be "state_machine". So the isRequired will not be needed, right?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I tried to use the validate way, but the DX is worst as I'm not able to attache the workflow name in the deprecation message. For recall, the workflow name is the key of the prototype. So I prefer this way.

More over, there are more code and finally the argument "making it easier to update the code" is not really an issue, since I (I guess) will update the code for SF 4.0

@nicolas-grekasnicolas-grekas added this to the3.3 milestoneApr 13, 2017
Before this patch, the default type is "workflow". Most of the time a"state_machine" is better because it's simpler and it involves lessknowledge to be able to use it.So this patch deprecate a missing type in Symfony 3.3. And In Symfony4.0 the default value will become "state_machine".
@lyrixxlyrixxforce-pushed theworkflow-default-type branch from88300fb to004751cCompareApril 13, 2017 14:36
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

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

👍

$registryDefinition =$container->getDefinition('workflow.registry');

foreach ($workflowsas$name =>$workflow) {
if (!array_key_exists('type',$workflow)) {
Copy link
Member

Choose a reason for hiding this comment

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

Why notisset()?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I don't know. It's a matter of personal stylehere, isn't ?

@lyrixx
Copy link
MemberAuthor

👍

@nicolas-grekas
Copy link
Member

Thank you@lyrixx.

@nicolas-grekasnicolas-grekas merged commit004751c intosymfony:masterApr 18, 2017
nicolas-grekas added a commit that referenced this pull requestApr 18, 2017
… of a workflow (lyrixx)This PR was merged into the 3.3-dev branch.Discussion----------[FrameworkBundle][Workflow] Deprecate the default type of a workflow| Q             | A| ------------- | ---| Branch?       | 3.3| Bug fix?      | no| New feature?  | no| BC breaks?    | no| Deprecations? | yes| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | ----Before this patch, the default type is "workflow". Most of the time a"state_machine" is better because it's simpler and it involves lessknowledge to be able to use it.So this patch deprecate a missing type in Symfony 3.3. And In Symfony4.0 the default value will become "state_machine".Commits-------004751c [FrameworkBundle][Workflow] Deprecate the default type of a workflow
@lyrixxlyrixx deleted the workflow-default-type branchApril 18, 2017 15:46
@fabpotfabpot mentioned this pull requestMay 1, 2017
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@xabbuhxabbuhxabbuh left review comments

@stofstofstof requested changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

+1 more reviewer

@HeahDudeHeahDudeHeahDude approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

3.3

Development

Successfully merging this pull request may close these issues.

6 participants

@lyrixx@nicolas-grekas@stof@xabbuh@HeahDude@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp