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 Documentation for Collection constraint Required/Optional options#2432

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

Conversation

@benglass
Copy link
Contributor

QA
Doc fix?yes
New docs?yes
Applies to2.1
Fixed tickets999

#999

Copy link
Member

Choose a reason for hiding this comment

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

the heading line should be as long as the heading title

@benglass
Copy link
ContributorAuthor

Note: YML and XML examples for configuration are not included. Worked with weaverryan to try to come up with a working version in YML without success.

This gist contains the YML configuration I tried:
https://gist.github.com/afishnamedsquish/5277987

The issue was that the constraint for the field needed to be parsed into an instance of Required or Optional and instead it was always parsed into an array with a single instance of Required or Optional in it. Might be a YML limitation or just something wrong with the syntax I tried.

Copy link
Member

Choose a reason for hiding this comment

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

some line breaking missing.

@benglass
Copy link
ContributorAuthor

Fixed whitespace issues from your comments.

Copy link
Member

Choose a reason for hiding this comment

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

I prefer to have the 2= lined up with eachother.

Formatting changes per comments from@wouterj
Change 'example' to 'instance'.
Copy link
Member

Choose a reason for hiding this comment

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

completely from the ``profileData`` array [...]

Add variable indicators around profileData
Removed use statements for Required/Optional. Instead use Assert\Collection\Required.
@stof
Copy link
Member

stof commentedApr 4, 2013

you should add the YAML and XML mapping too

@wouterj
Copy link
Member

@stof it seems like this is not possible with Yaml and Xml. Afishnamedsquish, Ryan and I have tried it but can't come with a solution. Even bernhard didn't know the format, see also:https://gist.github.com/afishnamedsquish/5277987
If you know it, you're welcome to post it! ;-)

@stof
Copy link
Member

stof commentedApr 5, 2013

@wouterj This should be reported as a bug if YAML and XML don't support it. Can you open a ticket ?

@wouterj
Copy link
Member

@stof, yes I will do

weaverryan added a commit that referenced this pull requestApr 9, 2013
…optional_required_docsValidator Documentation for Collection constraint Required/Optional options
@weaverryanweaverryan merged commit2928045 intosymfony:2.1Apr 9, 2013
@weaverryan
Copy link
Member

Hey!

This is a really nice entry - very clearly explained, nice work! I did tweak some minor language at sha:cf049ed, because iirc,Required doesn't really make the key required, it just means that the validation rules will be applied always (and so theNotBlank really makes it required).

Thanks!

@xabbuh
Copy link
Member

This works for me:

Acme\AuthorBundle\Entity\Author:properties:profileData:             -Collection:fields:alternate_email:constraints:                            -Collection\Optional:                                -Email:~

Can someone confirm?

@wouterj
Copy link
Member

negative for sf2.1 (didn't test it in other versions)

fabpot added a commit to symfony/symfony that referenced this pull requestJul 21, 2013
This PR was submitted for the 2.1 branch but it was merged into the 2.2 branch instead (closes#7930).Discussion----------handle Optional and Required constraints from XML or YAML sources correc......tly| Q             | A| ------------- | ---| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#7575| License       | MIT| Doc PR        |symfony/symfony-docs#2432Commits-------a93a23a handle Optional and Required constraints from XML or YAML sources correctly
@xabbuh
Copy link
Member

Now thatsymfony/symfony#7930 is merged. Is any work left here?

@benglass
Copy link
ContributorAuthor

An example of YML configuration could be added to the docs

@wouterj
Copy link
Member

And a xml example

@xabbuh
Copy link
Member

You're right, see#2841 for this.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@benglass@stof@wouterj@weaverryan@xabbuh

[8]ページ先頭

©2009-2025 Movatter.jp