Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ClassMetadata.php

function ClassMetadata::addPropertyConstraint

Adds a constraint to the given property.

Return value

$this

2 calls to ClassMetadata::addPropertyConstraint()
ClassMetadata::addConstraint in vendor/symfony/validator/Mapping/ClassMetadata.php
If the constraint {@link Cascade} is added, the cascading strategy will be changed to {@link CascadingStrategy::CASCADE}.
ClassMetadata::addPropertyConstraints in vendor/symfony/validator/Mapping/ClassMetadata.php

File

vendor/symfony/validator/Mapping/ClassMetadata.php, line 222

Class

ClassMetadata
Default implementation of {@link ClassMetadataInterface}.

Namespace

Symfony\Component\Validator\Mapping

Code

public function addPropertyConstraint(string $property, Constraint $constraint) : static {
    if (!isset($this->properties[$property])) {
        $this->properties[$property] = new PropertyMetadata($this->getClassName(), $property);
        $this->addPropertyMetadata($this->properties[$property]);
    }
    $constraint->addImplicitGroupName($this->getDefaultGroup());
    $this->properties[$property]
        ->addConstraint($constraint);
    return $this;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal