/** * {@inheritDoc} */ public function saveInvoiceItem(InvoiceItemInterface $invoiceItem) { if (!$this->invoiceAcl->canView($invoiceItem->getInvoice())) { throw new AccessDeniedException(); } if (!$this->invoiceItemAcl->canCreate()) { throw new AccessDeniedException(); } $newInvoiceItem = $this->isNewInvoiceItem($invoiceItem); if (!$newInvoiceItem && !$this->invoiceItemAcl->canEdit($invoiceItem)) { throw new AccessDeniedException(); } $this->realManager->saveInvoiceItem($invoiceItem); if ($newInvoiceItem) { $this->invoiceItemAcl->setDefaultAcl($invoiceItem); } }
/** * {@inheritDoc} */ protected function doSaveInvoiceItem(InvoiceItemInterface $invoiceItem) { $this->em->persist($invoiceItem->getInvoice()); $this->em->persist($invoiceItem); $this->em->flush(); }