validateNode example

if (!$data instanceof TypedDataInterface) {
      throw new \InvalidArgumentException('The passed value must be a typed data object.');
    }

    // You can pass a single constraint or an array of constraints.     // Make sure to deal with an array in the rest of the code.     if (isset($constraints) && !is_array($constraints)) {
      $constraints = [$constraints];
    }

    $this->validateNode($data$constraints$is_root_call);
    return $this;
  }

  /** * Validates a Typed Data node in the validation tree. * * If no constraints are passed, the data is validated against the * constraints specified in its data definition. If the data is complex or a * list and no constraints are passed, the contained properties or list items * are validated recursively. * * @param \Drupal\Core\TypedData\TypedDataInterface $data * The data to validated. * @param \Symfony\Component\Validator\Constraint[]|null $constraints * (optional) If set, an array of constraints to validate. * @param bool $is_root_call * (optional) Whether its the most upper call in the type data tree. * * @return $this */
Home | Imprint | This part of the site doesn't use cookies.