I've got to make a shop based on sylius able to sell free products. In order to do so, I've followed the doc "Customizing Validation" and made thoses modifications :
#AppBundle/Resources/config/validation.yml
Sylius\Component\Core\Model\ChannelPricing:
# see http://docs.sylius.org/en/latest/customization/validation.html
#the original constraint said that the minimum price is 0.01 in vendor/sylius/sylius/src/Sylius/Bundle/CoreBundle/Resources/config/validation/ChannelPricing.xml
properties:
price:
- NotBlank:
message: sylius.channel_pricing.price.not_blank
groups: [app_product]
- Range:
min: 0
minMessage: app.channel_pricing.price.min
groups: [app_product]
#app/config/parameters.yml
parameters:
sylius.form.type.channel_pricing.validation_groups: [app_product] # see http://docs.sylius.org/en/latest/customization/validation.html
it result in nothing : in the symfony profiler, the sylius validation group is still appplied.
I can't figured out what I did bad.
please note that :
- I tried to store the parameter into the service.yml file, it did change nothing.
- I don't know how to find the name for the parameter, so I used a name similar to the ressource
sylius.channel_pricing
(see :bin/console sylius:debug:resource sylius.channel_pricing
)