documentReferenceGenerator = $documentReferenceGenerator; $this->addressSolver = $addressSolver; } public function initFromOrderShop(DocumentInterface $document, OrderShopInterface $orderShop) :DocumentInterface { $merchantAddress = $orderShop->getSection()->getMerchant()->getAddress(); $buyerAddress = $orderShop->getInvoiceAddress(); //TODO a discuter, doit on garder le lien avec merchant pr la référence ou le mettre par section ? Est-ce que le nom de cette fonction est approprié. on fait une invoice et ça s'appele initFromOrderShop $document->setReference($this->documentReferenceGenerator->buildReference($orderShop->getSection()->getMerchant(), $document->getType())) ; $document->setMerchantAddress($merchantAddress); $document->setBuyerAddress($buyerAddress); $document->setMerchantAddressText($this->addressSolver->getSummary($merchantAddress)); $document->setBuyerAddressText($this->addressSolver->getSummary($buyerAddress)); $document->addOrderShop($orderShop); $document->setCreatedBy($orderShop->getUser()); return $document; } }