diff --git a/src/Entity/PriceInformations/Pricedetail.php b/src/Entity/PriceInformations/Pricedetail.php index 4b674e79..6b359a37 100644 --- a/src/Entity/PriceInformations/Pricedetail.php +++ b/src/Entity/PriceInformations/Pricedetail.php @@ -115,6 +115,7 @@ class Pricedetail extends DBElement /** * @var int * @ORM\Column(type="integer") + * @Assert\Positive() */ protected $min_discount_quantity = 1; diff --git a/src/Form/Part/PricedetailType.php b/src/Form/Part/PricedetailType.php index 0794eaca..c9f0eade 100644 --- a/src/Form/Part/PricedetailType.php +++ b/src/Form/Part/PricedetailType.php @@ -48,8 +48,12 @@ class PricedetailType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { //No labels needed, we define translation in templates - $builder->add("min_discount_quantity", IntegerType::class); - $builder->add("price_related_quantity", IntegerType::class); + $builder->add("min_discount_quantity", IntegerType::class, [ + 'attr' => ['min' => 1] + ]); + $builder->add("price_related_quantity", IntegerType::class, [ + 'attr' => ['min' => 1] + ]); $builder->add("price", NumberType::class); $builder->add("currency", CurrencyEntityType::class, ['required' => false]); }