A
A
Alexander2021-11-11 09:28:31
symfony
Alexander, 2021-11-11 09:28:31

Why can't I override the NotBlank validation rule?

All good
people, please tell me what I'm doing wrong
in the symphony project using the plugin. It has validation rules written in the yaml file.
I'm trying to override the rule for one field and I can't figure out why it doesn't work correctly

BitBag\SyliusCmsPlugin\Entity\PageTranslation:
    properties:
        ******* другие правила
        content:
            - NotBlank:
                message: bitbag_sylius_cms_plugin.page.content.not_blank
                groups: [bitbag]
            - Length:
                min: 2
                minMessage: bitbag_sylius_cms_plugin.page.content.min_length
                groups: [bitbag]


I override my option in the config/validator/validation.yaml file
BitBag\SyliusCmsPlugin\Entity\PageTranslation:
    properties:
        content:
            - NotBlank:
                allowNull: true
                groups: [bitbag]
            -  Blank:
                groups: [bitbag]

I tried to get rid of this in different ways NotBlank
simply prescribed allowNull: true
set Blank or isNull
Then it turns out to be a circus
If I leave the field empty, the validator swears that the field cannot be empty
, and if I add content, it swears that it MUST be empty
What am I doing wrong?
I tried to disable the rule in the vendor file - the rules are disabled

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question