Пример #1
0
 public function __construct(Shipment $shipment, DTOBuilderFactoryInterface $dtoBuilderFactory)
 {
     $this->entity = $shipment;
     $this->dtoBuilderFactory = $dtoBuilderFactory;
     $this->entityDTO = new ShipmentDTO();
     $this->setId();
     $this->setTime();
     foreach ($this->entity->getShipmentTrackers() as $shipmentTracker) {
         $this->entityDTO->shipmentTrackers[] = $this->dtoBuilderFactory->getShipmentTrackerDTOBuilder($shipmentTracker)->build();
     }
     foreach ($this->entity->getShipmentItems() as $hipmentTrack) {
         $this->entityDTO->shipmentItems[] = $this->dtoBuilderFactory->getShipmentItemDTOBuilder($hipmentTrack)->build();
     }
     foreach ($this->entity->getShipmentComments() as $shipmentComment) {
         $this->entityDTO->shipmentComments[] = $this->dtoBuilderFactory->getShipmentCommentDTOBuilder($shipmentComment)->build();
     }
 }