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

Documentation related to validation_groups bugged #484

Open
elboletaire opened this issue Oct 13, 2022 · 0 comments
Open

Documentation related to validation_groups bugged #484

elboletaire opened this issue Oct 13, 2022 · 0 comments

Comments

@elboletaire
Copy link

elboletaire commented Oct 13, 2022

Sylius docs version: latest

Description
The configuration reference is wrong, since it's specifying a validation_grups as an array value of an already defined scalar value, see https://github.com/Sylius/SyliusResourceBundle/blob/1.10/docs/reference.md:

sylius_resource:
    resources:
        app.book:
            driver: doctrine/orm
            classes:
                #[...]
                form: Sylius\Bundle\ResourceBundle\Form\Type\DefaultResourceType
                    validation_groups: [sylius] # this cannot be in this level, since `form` is already a scalar value

Trying to define it that way will crash because it won't be able to properly parse the YAML file.

Note that I was trying to define the validation groups, because when following the forms documentation, there's a point where you have to define your service, and it uses the validation groups as an argument:

app.book.form.type:
    class: App\Form\Type\BookType
    tags:
        - { name: form.type }
    arguments: ['%app.model.book.class%', '%app.book.form.type.validation_groups%']

Trying to pass that %app.book.form.type.validation_groups% crashes for me with error You have requested a non-existent parameter "app.book.form.type.validation_groups". This is why I'm trying to define validation_groups for this specific Form Type (although I'm not sure that's the way to proceed, but I certainly need validations here and it's not working, so I guess it has to do with the validation group nor properly defined).

I've seen there's a way to specify the validation groups per route, but I was more interested in a generic way for the entire resource tbh.

Can these inconsistencies be fixed?

And am I understanding it ok? Do I need to define the validation_groups for the resource?

Edit: I think there's no need at all to define that validation_groups argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant