8000 Document proper usage of toMany collections (denormalization + validation) · Issue #504 · api-platform/docs · GitHub
[go: up one dir, main page]

Skip to content

Document proper usage of toMany collections (denormalization + validation) #504

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
soyuka opened this issue Jun 12, 2018 · 2 comments
Closed

Comments

@soyuka
Copy link
Member
soyuka commented Jun 12, 2018

See api-platform/core#1534

@bendavies what's the validation trick? Put the validation on the property instead of the getter?

@bendavies
Copy link
Contributor
bendavies commented Jun 12, 2018

Accessor must call getValues:

public function getFoo(): array
{
    return $this->foos->getValues();
}

validation:
replace

<property name="foos">
    <constraint name="Valid"/>
</property>

with

<getter property="foos">
    <constraint name="Valid"/>
</getter>

or the equivalent if you are using yaml/annotations.

@soyuka
Copy link
Member Author
soyuka commented Feb 20, 2019

#740 finally took time to document that :D

@soyuka soyuka closed this as completed Feb 20, 2019
soyuka added a commit to soyuka/doc that referenced this issue Feb 20, 2019
soyuka added a commit to soyuka/doc that referenced this issue Feb 20, 2019
soyuka added a commit to soyuka/doc that referenced this issue Feb 20, 2019
soyuka added a commit that referenced this issue Feb 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants
0