Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[2.8][Form] Deprecate alias tag option #15926

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 3 commits into from

Conversation

wouterj
Copy link
Member

@wouterj wouterj commented Sep 26, 2015

FQCN should be used since 2.8 instead, so a deprecation error should be triggered when the alias setting is used.

Furthermore, the name of the option doesn't make much sense for form types (as it's the alias of the field it applies to), so I renamed it to extended_type. I'm open to any other suggestions.

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

$alias = isset($tag[0]['alias'])
? $tag[0]['alias']
: $serviceId;
$extendedType = $serviceId;
Copy link
Member

Choose a reason for hiding this comment

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

we need a deprecation to be triggered when the service id is used, because such case makes no sense actually.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree that it doesn't mean anything, but it's the default at the moment. Do you think we should require setting the extended_type attribute and trigger an exception if it (or alias) is not set?

Copy link
Contributor

Choose a reason for hiding this comment

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

@wouterj yes if neither the alias or extended_type is set, it should trigger a deprecation as well. in 3.0 it should then throw an exception.

Copy link
Contributor

Choose a reason for hiding this comment

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

please move this to the else block which makes it more clear what code can be removed later

@wouterj wouterj force-pushed the form-alias_option_deprecation branch from d048496 to 3a62981 Compare September 30, 2015 12:54
@wouterj
Copy link
Member Author

wouterj commented Sep 30, 2015

PR updated

@Tobion
Copy link
Contributor

Tobion commented Oct 1, 2015

Status: Needs Work

@wouterj
Copy link
Member Author

wouterj commented Oct 1, 2015

Unless I missed something, I've now finished this PR:

  • Added CHANGELOG + UPGRADE notes
  • Deprecated the alias option for form types, but didn't trigger any deprecation notice as extra attributes don't cause problems (and it's not possible with the current BC layer to remove alias argument usages in the Symfony bundles)
  • Renamed alias to extended_type for form type extensions (which is consistent with the FormTypeExtensionInterface#getExtendedType() method btw)
  • Changed all usages of the deprecated options in the Symfony code base
  • Deprecated the fallback to service id for alias/extended_type, extended_type is now required

@wouterj wouterj force-pushed the form-alias_option_deprecation branch from f15bfdd to 9b76e71 Compare October 1, 2015 08:39
@wouterj
Copy link
Member Author

wouterj commented Oct 1, 2015

Status: Needs Review

@wouterj
Copy link
Member Author

wouterj commented Oct 1, 2015

Build failures are not related to this PR btw

@@ -235,6 +235,23 @@ Form
match the type returned by `getExtendedType` is now forbidden. Fix your
implementation to define the right type.

* The alias option of the `form.type_extension` tag is deprecated in favor of
the `extended_type` option.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe also use extended_type/extended-type esp. since the following is code is xml which will cause confusion.

@wouterj
Copy link
Member Author

wouterj commented Oct 1, 2015

Fixed, thanks @Tobion

$alias = isset($tag[0]['alias'])
? $tag[0]['alias']
: $serviceId;
$extendedType = null;
Copy link
Contributor

Choose a reason for hiding this comment

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

this is useless

Copy link
Contributor

Choose a reason for hiding this comment

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

fixed

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, it is useless, but it doesn't hurt that much and reduces the changes to be done in 3.0.

Copy link
Contributor

Choose a reason for hiding this comment

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

in 3.0 we will throw an exception, there is no default null

@Tobion
Copy link
Contributor

Tobion commented Oct 1, 2015

Thank you @wouterj.

@Tobion Tobion closed this in e7325b7 Oct 1, 2015
@wouterj wouterj deleted the form-alias_option_deprecation branch October 1, 2015 15:57
fabpot added a commit that referenced this pull request Oct 1, 2015
…ibutes (WouterJ)

This PR was merged into the 3.0-dev branch.

Discussion
----------

[WIP][3.0][Form] Removed usage of deprecated form tag attributes

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

WIP because it needs some adjustments after #15926 is merged

Commits
-------

215fdbe Removed alias attribute usages
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.

4 participants