Skip to content
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

Removing the alias stuff - not required after symfony/symfony#17074 #6746

Merged
merged 2 commits into from
Aug 2, 2016

Conversation

weaverryan
Copy link
Member

Thanks to symfony/symfony#17074 (merged all the way back into 2.3), alias is not required anymore. So why mention it?

As I understand it, validators work like the new form types: it's ok that `validatedBy returns a class name: the validation system will notice that you have a tagged service matching this class and will use that instead of creating it new.

Make sure to use the 'alias_name' when you have configured your validator as a service. Otherwise your validator class
will be simply instantiated without your dependencies.
In earlier versions of Symfony, the tag required an ``alias`` key (usually set
to the class name). This is still allowed your constraint's ``validateBy``
Copy link
Member

Choose a reason for hiding this comment

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

this sentence is missing something between "This is still allowed" and "your constraint's [...]". Maybe "and" or a comma or just a rewording :)

Also, it should be validateBy() (we suffix all methods mentioned by parenthesis)

@wouterj
Copy link
Member

wouterj commented Jul 10, 2016

Status: Reviewed

@weaverryan weaverryan merged commit 31afb0e into 2.7 Aug 2, 2016
weaverryan added a commit that referenced this pull request Aug 2, 2016
…ymfony#17074 (weaverryan)

This PR was merged into the 2.7 branch.

Discussion
----------

Removing the alias stuff - not required after symfony/symfony#17074

Thanks to symfony/symfony#17074 (merged all the way back into 2.3), `alias` is not required anymore. So why mention it?

As I understand it, validators work like the new form types: it's ok that `validatedBy returns a class name: the validation system will notice that you have a tagged service matching this class and will use that instead of creating it new.

Commits
-------

31afb0e line break
2ec049d Removing the alias stuff - not required after symfony/symfony#17074
@xabbuh xabbuh deleted the custom_constraint_tweak branch August 2, 2016 16:29
will be simply instantiated without your dependencies.
In earlier versions of Symfony, the tag required an ``alias`` key (usually set
to the class name). This is still allowed your constraint's ``validateBy``
method can return this alias (instead of a class name).
Copy link
Member

Choose a reason for hiding this comment

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

@weaverryan The last sentence reads weird. Was it meant to be this way?

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.

None yet

4 participants