validateConstraints example

    // 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) {
        $this->validateNode($property);
      }
    }
Home | Imprint | This part of the site doesn't use cookies.