Symfony\Component\Form\FormError::__construct PHP Method

__construct() public method

Any array key in $messageParameters will be used as a placeholder in $messageTemplate.
See also: Symfony\Component\Translation\Translator
public __construct ( string $messageTemplate, array $messageParameters = [], integer | null $messagePluralization = null )
$messageTemplate string The template for the error message
$messageParameters array The parameters that should be substituted in the message template.
$messagePluralization integer | null The value for error message pluralization
    public function __construct($messageTemplate, array $messageParameters = array(), $messagePluralization = null)
    {
        $this->messageTemplate = $messageTemplate;
        $this->messageParameters = $messageParameters;
        $this->messagePluralization = $messagePluralization;
    }

Usage Example

 public function __construct($propertypath, $messageTemplate, array $messageParameters = array())
 {
     parent::__construct($messageTemplate, $messageParameters);
     $this->propertypath = $propertypath;
 }