/**
  * {@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}
  */
 public function findAllInvoices()
 {
     $invoices = $this->realManager->findAllInvoices();
     if (isset($invoices)) {
         foreach ($invoices as $invoice) {
             if (!$this->invoiceAcl->canView($invoice)) {
                 throw new AccessDeniedException();
             }
         }
     }
     return $invoices;
 }