Example #1
0
 /**
  * @param \Orm\Zed\Sales\Persistence\SpySalesOrderItem $orderItemEntity
  *
  * @return \Generated\Shared\Transfer\ItemTransfer
  */
 public function hydrateOrderItemTransfer(SpySalesOrderItem $orderItemEntity)
 {
     $itemTransfer = new ItemTransfer();
     $itemTransfer->fromArray($orderItemEntity->toArray(), true);
     $itemTransfer->setProcess($orderItemEntity->getProcess()->getName());
     $itemTransfer->setUnitGrossPrice($orderItemEntity->getGrossPrice());
     $this->hydrateStateHistory($orderItemEntity, $itemTransfer);
     $this->hydrateCurrentSalesOrderItemState($orderItemEntity, $itemTransfer);
     foreach ($orderItemEntity->getOptions() as $orderItemOptionEntity) {
         $productOptionsTransfer = new ProductOptionTransfer();
         $productOptionsTransfer->setUnitGrossPrice($orderItemOptionEntity->getGrossPrice());
         $productOptionsTransfer->fromArray($orderItemOptionEntity->toArray(), true);
         $itemTransfer->addProductOption($productOptionsTransfer);
     }
     return $itemTransfer;
 }