public static function loadValidatorMetadata(ClassMetadata $metadata) { parent::loadValidatorMetadata($metadata); $metadata->addPropertyConstraint('code', new Assert\NotBlank()); $metadata->addPropertyConstraint('code', new Assert\Length(['max' => 16])); $metadata->addPropertyConstraint('minOrderValue', new Assert\Range(['min' => 0, 'max' => 4294967295])); $metadata->addPropertyConstraint('maxOrderValue', new Assert\Range(['min' => 0, 'max' => 4294967295])); }
public function __construct(AbstractPromotion $promotion, DTOBuilderFactoryInterface $dtoBuilderFactory) { $this->entity = $promotion; $this->dtoBuilderFactory = $dtoBuilderFactory; $this->entityDTO = $this->getEntityDTO(); $this->setId(); $this->setTime(); $this->setStartEndDate(); $this->setRedemption(); $this->entityDTO->name = $this->entity->getName(); $this->entityDTO->value = $this->entity->getValue(); $this->entityDTO->reducesTaxSubtotal = $this->entity->getReducesTaxSubtotal(); $this->entityDTO->isRedemptionCountValid = $this->entity->isRedemptionCountValid(); $this->entityDTO->type = $this->dtoBuilderFactory->getPromotionTypeDTOBuilder($this->entity->getType())->build(); }
public static function loadValidatorMetadata(ClassMetadata $metadata) { parent::loadValidatorMetadata($metadata); $metadata->addPropertyConstraint('quantity', new Assert\NotNull()); $metadata->addPropertyConstraint('quantity', new Assert\Range(['min' => 0, 'max' => 65535])); }
public function testGetUnitPriceWithExact() { $this->promotion->setType(PromotionType::exact()); $this->promotion->setValue(20); $this->assertSame(20, $this->promotion->getUnitPrice(1000)); }
public static function loadValidatorMetadata(ClassMetadata $metadata) { parent::loadValidatorMetadata($metadata); $metadata->addPropertyConstraint('code', new Assert\NotBlank()); $metadata->addPropertyConstraint('code', new Assert\Length(['max' => 16])); }