findConstraints example


        }
    }

    /** * Validates a node's value against all constraints in the given group. */
    private function validateInGroup(mixed $value, ?string $cacheKey, MetadataInterface $metadata, string $group, ExecutionContextInterface $context): void
    {
        $context->setGroup($group);

        foreach ($metadata->findConstraints($group) as $constraint) {
            if ($constraint instanceof Existence) {
                continue;
            }

            // Prevent duplicate validation of constraints, in the case             // that constraints belong to multiple validated groups             if (null !== $cacheKey) {
                $constraintHash = $this->generateCacheKey($constraint, true);
                // instanceof Valid: In case of using a Valid constraint with many groups                 // it makes a reference object get validated by each group                 if ($constraint instanceof Composite || $constraint instanceof Valid) {
                    
// Pass the canonical representation of the data as validated value to     // constraint validators, such that they do not have to care about Typed     // Data.     $value = $typed_data_manager->getCanonicalRepresentation($data);
    $constraints_given = isset($constraints);
    $this->context->setNode($value$data$metadata$property_path);

    if (isset($constraints) || !$this->context->isGroupValidated($cache_key, Constraint::DEFAULT_GROUP)) {
      if (!isset($constraints)) {
        $this->context->markGroupAsValidated($cache_key, Constraint::DEFAULT_GROUP);
        $constraints = $metadata->findConstraints(Constraint::DEFAULT_GROUP);
      }
      $this->validateConstraints($value$cache_key$constraints);
    }

    // If the data is a list or complex data, validate the contained list items     // or properties. However, do not recurse if the data is empty.     // Next, we do not recurse if given constraints are validated against an     // entity, since we should determine whether the entity matches the     // constraints and not whether the entity validates.     if (($data instanceof ListInterface || $data instanceof ComplexDataInterface) && !$data->isEmpty() && !($data instanceof EntityAdapter && $constraints_given)) {
      foreach ($data as $property) {
        

        }
    }

    /** * Validates a node's value against all constraints in the given group. */
    private function validateInGroup(mixed $value, ?string $cacheKey, MetadataInterface $metadata, string $group, ExecutionContextInterface $context): void
    {
        $context->setGroup($group);

        foreach ($metadata->findConstraints($group) as $constraint) {
            if ($constraint instanceof Existence) {
                continue;
            }

            // Prevent duplicate validation of constraints, in the case             // that constraints belong to multiple validated groups             if (null !== $cacheKey) {
                $constraintHash = $this->generateCacheKey($constraint, true);
                // instanceof Valid: In case of using a Valid constraint with many groups                 // it makes a reference object get validated by each group                 if ($constraint instanceof Composite || $constraint instanceof Valid) {
                    
Home | Imprint | This part of the site doesn't use cookies.