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

Breadcrumb

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

function ClassMetadata::addGetterConstraint

Adds a constraint to the getter of the given property.

The name of the getter is assumed to be the name of the property with an uppercased first letter and the prefix "get", "is" or "has".

Return value

$this

1 call to ClassMetadata::addGetterConstraint()
ClassMetadata::addGetterConstraints in vendor/symfony/validator/Mapping/ClassMetadata.php

File

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

Class

ClassMetadata
Default implementation of {@link ClassMetadataInterface}.

Namespace

Symfony\Component\Validator\Mapping

Code

public function addGetterConstraint(string $property, Constraint $constraint) : static {
    if (!isset($this->getters[$property])) {
        $this->getters[$property] = new GetterMetadata($this->getClassName(), $property);
        $this->addPropertyMetadata($this->getters[$property]);
    }
    $constraint->addImplicitGroupName($this->getDefaultGroup());
    $this->getters[$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