documentReferenceGenerator = $documentReferenceGenerator; } public function initFromOrderShop(DocumentInterface $document, OrderShopInterface $orderShop) :DocumentInterface { $merchantAddress = $orderShop->getMerchant()->getAddress(); $buyerAddress = $orderShop->getInvoiceAddress(); $document->setReference($this->documentReferenceGenerator->buildReference($orderShop->getMerchant())) ; $document->setMerchantAddress($merchantAddress); $document->setBuyerAddress($buyerAddress); $document->setMerchantAddressText($merchantAddress->getSummary()); $document->setBuyerAddressText($buyerAddress->getSummary()); $document->addOrderShop($orderShop); $document->setCreatedBy($orderShop->getUser()); return $document; } }