You are here

class MachineNameUniqueConstraint in Machine name 8

Checks if an entity field has a unique value.

Plugin annotation


@Constraint(
  id = "MachineNameUnique",
  label = @Translation("Unique machine name constraint", context = "Validation"),
)

Hierarchy

Expanded class hierarchy of MachineNameUniqueConstraint

File

src/Plugin/Validation/Constraint/MachineNameUniqueConstraint.php, line 15

Namespace

Drupal\machine_name\Plugin\Validation\Constraint
View source
class MachineNameUniqueConstraint extends Constraint {
  public $message = 'The machine name %value is already in use. It must be unique.';

  /**
   * {@inheritdoc}
   */
  public function validatedBy() {
    return '\\Drupal\\machine_name\\Plugin\\Validation\\Constraint\\MachineNameUniqueValidator';
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MachineNameUniqueConstraint::$message public property
MachineNameUniqueConstraint::validatedBy public function Returns the name of the class that validates this constraint.