You are here

class DeveloperToUserConversionUserNameAlreadyTakenException in Apigee Edge 8

Throw when developer's username is already taken in Drupal.

Hierarchy

Expanded class hierarchy of DeveloperToUserConversionUserNameAlreadyTakenException

File

src/Exception/DeveloperToUserConversionUserNameAlreadyTakenException.php, line 29

Namespace

Drupal\apigee_edge\Exception
View source
class DeveloperToUserConversionUserNameAlreadyTakenException extends DeveloperToUserConversationInvalidValueException {

  /**
   * DeveloperToUserConversionUserNameAlreadyTakenException constructor.
   *
   * @param \Drupal\apigee_edge\Entity\DeveloperInterface $developer
   *   Developer entity.
   * @param \Symfony\Component\Validator\ConstraintViolationInterface $violation
   *   Constraint violation.
   * @param string $message
   *   Exception message.
   * @param int $code
   *   Error code.
   * @param \Throwable|null $previous
   *   Previous exception.
   */
  public function __construct(DeveloperInterface $developer, ConstraintViolationInterface $violation, string $message = 'The username "@username" is already taken in Drupal.', int $code = 0, ?\Throwable $previous = NULL) {
    $message = strtr($message, [
      '@username' => $developer
        ->getUserName(),
    ]);
    parent::__construct('username', 'name', $violation, $developer, $message, $code, $previous);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DeveloperToUserConversationInvalidValueException::$source protected property The source property on the developer.
DeveloperToUserConversationInvalidValueException::$target protected property The name of the destination field on the user.
DeveloperToUserConversationInvalidValueException::$violation protected property Constraint violation.
DeveloperToUserConversationInvalidValueException::getSource public function The source property on the developer.
DeveloperToUserConversationInvalidValueException::getTarget public function The name of the destination field on the user.
DeveloperToUserConversationInvalidValueException::getViolation public function Constraint violation.
DeveloperToUserConversionException::$developer protected property Developer object.
DeveloperToUserConversionException::getDeveloper public function Returns the problematic developer.
DeveloperToUserConversionUserNameAlreadyTakenException::__construct public function DeveloperToUserConversionUserNameAlreadyTakenException constructor. Overrides DeveloperToUserConversationInvalidValueException::__construct