This topic contains 0 replies, has 1 voice, and was last updated by nevoeiro 6 years, 2 months ago.
- Topic
Hi there,
I’m trying to implement a validator for the quantity field on these entities:
– Oro\Bundle\OrderBundle\Entity\OrderLineItem
– Oro\Bundle\ShoppingListBundle\Entity\LineItem
– Oro\Bundle\CheckoutBundle\Entity\CheckoutLineItemI added a new Contraint and Validator to check the quantity value considering some custom logic. The validator is working fine when I’m on backend side.
For example, on backend, when I’m creating a new order, if I try to add a product with an invalid quantity I got my validator running and displaying the message I defined. Very nice!
But, I was expecting to have this working on frontend side too. My goal is to apply this validation when I add a new product to a shopping list (or update), but it’s not working.
Are there some config I need to add to have these available on frontend, or are these validators only working for backend?
Can you explain how can I add a validator that can cover all contexts? I mean, backend and frontend side.
my validation.yml:
1234567891011121314Oro\Bundle\OrderBundle\Entity\OrderLineItem:properties:quantity:- Test\Bundle\MyBundle\Validator\Constraints\MyConstraint: ~Oro\Bundle\ShoppingListBundle\Entity\LineItem:properties:quantity:- Test\Bundle\MyBundle\Validator\Constraints\MyConstraint:Oro\Bundle\CheckoutBundle\Entity\CheckoutLineItem:properties:quantity:- Test\Bundle\MyBundle\Validator\Constraints\MyConstraint: ~Thanks for helping ;)
The forum ‘OroCommerce’ is closed to new topics and replies.