/** * {@inheritdoc} */ public function invoice(InvoiceInterface $invoice) { if (!$invoice->getId()) { throw new \RuntimeException('The invoice is not persisted into the database'); } $this->generateReference($invoice, $this->registry->getManager()->getClassMetadata(get_class($invoice))->table['name']); }