public function __construct(TextOption $textOption, DTOBuilderFactoryInterface $dtoBuilderFactory) { $this->entity = $textOption; $this->dtoBuilderFactory = $dtoBuilderFactory; $this->entityDTO = new TextOptionDTO(); $this->setId(); $this->setTime(); $this->entityDTO->name = $this->entity->getname(); $this->entityDTO->description = $this->entity->getDescription(); $this->entityDTO->sortOrder = $this->entity->getSortOrder(); $this->entityDTO->type = $this->dtoBuilderFactory->getTextOptionTypeDTOBuilder($this->entity->getType())->build(); }