class CommentNameConstraintValidator extends ConstraintValidator implements ContainerInjectionInterface (View source)

Validates the CommentName constraint.

Properties

protected ExecutionContextInterface $context

Validator 2.5 and upwards compatible execution context.

protected UserStorageInterface $userStorage

User storage handler.

Methods

__construct(UserStorageInterface $user_storage)

Constructs a new CommentNameConstraintValidator.

static 
create(ContainerInterface $container)

Instantiates a new instance of this class.

validate($entity, Constraint $constraint)

{@inheritdoc}

int
getAnonymousContactDetailsSetting(CommentInterface $comment)

Gets the anonymous contact details setting from the comment.

Details

__construct(UserStorageInterface $user_storage)

Constructs a new CommentNameConstraintValidator.

Parameters

UserStorageInterface $user_storage

The user storage handler.

static create(ContainerInterface $container)

Instantiates a new instance of this class.

This is a factory method that returns a new instance of this class. The factory should pass any needed dependencies into the constructor of this class, but not the container itself. Every call to this method must return a new instance of this class; that is, it may not implement a singleton.

Parameters

ContainerInterface $container

The service container this instance should use.

validate($entity, Constraint $constraint)

{@inheritdoc}

Parameters

$entity
Constraint $constraint

protected int getAnonymousContactDetailsSetting(CommentInterface $comment)

Gets the anonymous contact details setting from the comment.

Parameters

CommentInterface $comment

The entity.

Return Value

int

The anonymous contact setting.