-
-
Notifications
You must be signed in to change notification settings - Fork 161
Closed
Description
| Q | A |
|---|---|
| Bug report? | no |
| Feature request? | no |
| BC Break report? | no |
| RFC? | no |
| Question | yes |
Moin!
We are currently working on overriding some validators for the checkout. For various reasons. In one case we have a sort of sub items whose stock we also want to validate. So we would like to override the CartStockAvailabilityValidator.
What is the best way to do this? In the checkout steps, the order is validated in its entirety, and the contraints for this are configured here.
# src/CoreShop/Bundle/CoreBundle/Resources/config/validation/Order.yml
CoreShop\Component\Core\Model\Order:
constraints:
- \CoreShop\Bundle\CoreBundle\Validator\Constraints\CartStockAvailability: { groups: ['coreshop'] }
- \CoreShop\Bundle\CoreBundle\Validator\Constraints\CartMinimumQuantity: { messageBelowMinimum: 'coreshop.cart_item.quantity_below_min_limit', groups: ['coreshop'] }
- \CoreShop\Bundle\CoreBundle\Validator\Constraints\CartMaximumQuantity: { messageAboveMaximum: 'coreshop.cart_item.quantity_above_max_limit', groups: ['coreshop'] }Unfortunately, we cannot replace validators. The configuration can only be extended, but not overwritten. Do we have to decorate the class now or what would be the best practice?
Metadata
Metadata
Assignees
Labels
No labels