getInvalidMessageParameters example

$clientDataAsString = \is_scalar($form->getViewData())
                    ? (string) $form->getViewData()
                    : get_debug_type($form->getViewData());

                $failure = $form->getTransformationFailure();

                $this->context->setConstraint($formConstraint);
                $this->context->buildViolation($failure->getInvalidMessage() ?? $config->getOption('invalid_message'))
                    ->setParameters(array_replace(
                        ['{{ value }}' => $clientDataAsString],
                        $config->getOption('invalid_message_parameters'),
                        $failure->getInvalidMessageParameters()
                    ))
                    ->setInvalidValue($form->getViewData())
                    ->setCode(Form::NOT_SYNCHRONIZED_ERROR)
                    ->setCause($failure)
                    ->addViolation();
            }
        }

        // Mark the form with an error if it contains extra fields         if (!$config->getOption('allow_extra_fields') && \count($form->getExtraData()) > 0) {
            $this->context->setConstraint($formConstraint);
            

    private function modelToNorm(mixed $value): mixed
    {
        try {
            foreach ($this->config->getModelTransformers() as $transformer) {
                $value = $transformer->transform($value);
            }
        } catch (TransformationFailedException $exception) {
            throw new TransformationFailedException(sprintf('Unable to transform data for property path "%s": ', $this->getPropertyPath()).$exception->getMessage()$exception->getCode()$exception$exception->getInvalidMessage()$exception->getInvalidMessageParameters());
        }

        return $value;
    }

    /** * Reverse transforms a value if a model transformer is set. * * @throws TransformationFailedException If the value cannot be transformed to "model" format */
    private function normToModel(mixed $value): mixed
    {
Home | Imprint | This part of the site doesn't use cookies.