Ejemplo n.º 1
0
 /**
  * {@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);
     }
 }
Ejemplo n.º 2
0
 /**
  * {@inheritDoc}
  */
 protected function doSaveInvoiceItem(InvoiceItemInterface $invoiceItem)
 {
     $this->em->persist($invoiceItem->getInvoice());
     $this->em->persist($invoiceItem);
     $this->em->flush();
 }