/** * @param \Generated\Shared\Transfer\InvoiceTransfer $invoiceTransfer * * @throws \Propel\Runtime\Exception\PropelException * @return \Generated\Shared\Transfer\InvoiceTransfer */ public function writeInvoice(InvoiceTransfer $invoiceTransfer) { $connection = $this->queryContainer->getConnection(); try { $connection->beginTransaction(); $this->writeAddress($invoiceTransfer); $this->persistInvoice($invoiceTransfer); $this->writeInvoiceTaxItems($invoiceTransfer); $this->writeInvoiceItems($invoiceTransfer); $this->writeInvoiceDiscounts($invoiceTransfer); $this->writeInvoiceExpenses($invoiceTransfer); $connection->commit(); } catch (PropelException $exception) { $connection->rollBack(); ErrorLogger::log($exception); if (Environment::isDevelopment()) { throw $exception; } } return $invoiceTransfer; }
/** * @param \Exception|\Throwable $exception * @param bool $output * @param bool $exit * * @return void */ public function handleException($exception, $output = true, $exit = true) { ErrorLogger::log($exception); try { $this->send500Header(); $this->doDatabaseRollback(); $this->cleanOutputBuffer(); if ($this->showExceptionStackTrace()) { $this->echoOutput($exception, $output); } else { if ($exit) { $this->showErrorPage(); } } } catch (Throwable $internalException) { ErrorLogger::log($internalException); } catch (Exception $internalException) { ErrorLogger::log($internalException); } if ($exit) { exit(-1); } }