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

[Validator] Allow Validator without the translator component#28520

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

@sroze
Copy link
Contributor

QA
Branch?master
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#28210
LicenseMIT
Doc PRø

Validator should be available without the Translator service.#28210 introduced a regression, it was not the case anymore:

  You have requested a non-existent service "translator".

This fixes it.

foreach ($builder->getMethodCalls()aslist($method,$arguments)) {
if ('setTranslator' ===$method) {
$translator =$arguments[0]instanceof Reference ?$container->findDefinition($arguments[0]) :$arguments[0];
if ($arguments[0]instanceof Reference) {
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't it be enough to make sure that the reference is tagged withIGNORE_ON_INVALID_REFERENCE (seehttps://symfony.com/doc/4.0/service_container/optional_dependencies.html#ignoring-missing-dependencies)?

dunglas reacted with thumbs up emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Just setting the reference as "nullable" wouldn't work, we'd have the same error. Though, your put is interesting: I've made sure it ignores the referenceonly if it's "nullable".

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Actually no. I've just reverted3e545e4 as it would break theValidatorBuilderInterface. AFAIK, that's the only way of dealing with it here.

@srozesrozeforce-pushed thevalidator-without-translator branch from3e545e4 to9e5ea39CompareSeptember 20, 2018 06:45
@nicolas-grekasnicolas-grekas added this to thenext milestoneSep 20, 2018
@srozesrozeforce-pushed thevalidator-without-translator branch from9e5ea39 toc0d7091CompareSeptember 20, 2018 06:52
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.

(usingon-invalid="null" wouldn't remove the need for doing this change as $translator is used below)

@srozesrozeforce-pushed thevalidator-without-translator branch from5c56d01 to2dc92d7CompareSeptember 20, 2018 07:09
@sroze
Copy link
ContributorAuthor

FYI, it's a very important bug, it prevents the following to work:

composer create-project symfony/website-skeleton:dev-master xxx

@nicolas-grekas
Copy link
Member

Thank you@sroze.

@nicolas-grekasnicolas-grekas merged commit2dc92d7 intosymfony:masterSep 20, 2018
nicolas-grekas added a commit that referenced this pull requestSep 20, 2018
…nt (sroze)This PR was merged into the 4.2-dev branch.Discussion----------[Validator] Allow Validator without the translator component| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#28210| License       | MIT| Doc PR        | øValidator should be available without the Translator service.#28210 introduced a regression, it was not the case anymore:```  You have requested a non-existent service "translator".```This fixes it.Commits-------2dc92d7 Allow validator without the translator
@nicolas-grekasnicolas-grekas modified the milestones:next,4.2Nov 1, 2018
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@xabbuhxabbuhxabbuh left review comments

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@chalasrchalasrchalasr approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

4.2

Development

Successfully merging this pull request may close these issues.

5 participants

@sroze@nicolas-grekas@xabbuh@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp