Sonata\Component\Transformer\InvoiceTransformer::createInvoiceElementFromOrderElement PHP Method

createInvoiceElementFromOrderElement() protected method

Creates an InvoiceElement based on an OrderElement.
protected createInvoiceElementFromOrderElement ( Sonata\Component\Order\OrderElementInterface $orderElement ) : Sonata\Component\Invoice\InvoiceElementInterface
$orderElement Sonata\Component\Order\OrderElementInterface
return Sonata\Component\Invoice\InvoiceElementInterface
    protected function createInvoiceElementFromOrderElement(OrderElementInterface $orderElement)
    {
        $invoice = $this->invoiceElementManager->create();
        $invoice->setOrderElement($orderElement);
        $invoice->setDescription($orderElement->getDescription());
        $invoice->setDesignation($orderElement->getDesignation());
        $invoice->setPrice($orderElement->getPrice(true));
        $invoice->setUnitPriceExcl($orderElement->getUnitPrice(false));
        $invoice->setUnitPriceInc($orderElement->getUnitPrice(true));
        $invoice->setVatRate($orderElement->getVatRate());
        $invoice->setQuantity($orderElement->getQuantity());
        $invoice->setTotal($orderElement->getTotal(true));
        return $invoice;
    }