<?php namespace Lc\ShopBundle\Services\Order; use Lc\ShopBundle\Context\OrderShopInterface; use Lc\ShopBundle\Model\Document; trait OrderUtilsDocumentTrait { public function createDocumentInvoice(OrderShopInterface $orderShop) { //TODO set invoiceNumber $merchantAddress = $orderShop->getMerchant()->getAddress(); $buyerAddress = $orderShop->getInvoiceAddress(); $document = $this->documentUtils->createDocument([ 'type' => Document::TYPE_INVOICE, 'title' => '', 'status' => 1, 'order_shops' => [$orderShop], 'merchant_address' => $merchantAddress, 'buyer_address' => $buyerAddress, 'created_by' => $orderShop->getUser() ]); return $document; } }