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(); }