getCachedConstraints example

if ($value !== null) {
                foreach ($value as &$row) {
                    unset($row['extensions']);
                }
            }
            $data->setValue($value);

            if ($field->is(Required::class)) {
                $this->validate([new NotBlank()]$data$parameters->getPath());
            }

            $constraints = $this->getCachedConstraints($field);
            $pricePath = $parameters->getPath() . '/price';

            foreach ($data->getValue() as $index => $price) {
                $this->validate($constraintsnew KeyValuePair((string) $index$price, true)$pricePath);
            }

            $this->ensureDefaultPrice($parameters$data->getValue());

            $converted = [];

            foreach ($value as $price) {
                
$field = $parent->getFields()->get($field->getPropertyName());

        return $field->is(Inherited::class);
    }

    protected function validateIfNeeded(Field $field, EntityExistence $existence, KeyValuePair $data, WriteParameterBag $parameters): void
    {
        if (!$this->requiresValidation($field$existence$data->getValue()$parameters)) {
            return;
        }

        $constraints = $this->getCachedConstraints($field);

        $this->validate($constraints$data$parameters->getPath());
    }

    /** * @return Constraint[] */
    protected function getConstraints(Field $field): array
    {
        return [];
    }

    
Home | Imprint | This part of the site doesn't use cookies.