/**
  * @param NotNullConstraintViolationException $exception
  * @throws ReportException
  */
 protected function throwExceptionOccuredWhileRemovingRightEntity(NotNullConstraintViolationException $exception)
 {
     $message = get_class($exception) . ' occurend while removing ' . $this->rightEntityClass . '.';
     $errorReport = new ErrorReport($message);
     $help = 'You have to set "orphanRemoval: true" on your mapping, ';
     $help .= 'or explicitly call ' . $this->managerClass . '::remove().';
     $errorReport->addHelp($help);
     $errorReport->addError($exception->getMessage());
     $errorReport->addCodeLinePreview($exception->getFile(), $exception->getLine());
     $errorReport->addMethodCode($this->leftEntity, $this->leftEntityRemover);
     throw new ReportException($this->getReport(), $errorReport);
 }
 /**
  * @param ORMInvalidArgumentException $exception
  * @throws ReportException
  */
 protected function inverseSideAdderThrowAdderOrmInvalidArgumentException(ORMInvalidArgumentException $exception)
 {
     $message = 'ORMInvalidArgumentException occured after calling ';
     $message .= $this->getInverseSideClassName() . '::' . $this->getInverseSideAdder() . '(), ';
     $message .= 'then ' . get_class($this->getManager()) . '::flush().';
     $errorReport = new ErrorReport($message);
     $errorReport->addError($exception->getMessage());
     $this->inverseSideAdderAddInverseSideEntityPersistError($errorReport);
     throw new ReportException($this->getReport(), $errorReport);
 }
コード例 #3
0
 /**
  * @param object $entity
  * @param string $method
  * @param string|null $error
  * @throws ReportException
  */
 protected function throwMethodDoesNotExists($entity, $method, $error)
 {
     $class = get_class($entity);
     $message = $class . '::' . $method . '() does not exists.';
     $errorReport = new ErrorReport($message);
     if ($error !== null) {
         $errorReport->addError($error);
     }
     throw new ReportException($this->getReport(), $errorReport);
 }