Skip to content

adding property errorPath #9582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/Symfony/Component/Form/FormError.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ class FormError
*/
protected $messagePluralization;

/**
* The error field name
* @var string
*/
protected $errorPath;

/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing line break

* Constructor
*
Expand All @@ -52,15 +58,17 @@ class FormError
* @param array $messageParameters The parameters that should be
* substituted in the message template.
* @param integer|null $messagePluralization The value for error message pluralization
* @param string $errorPath The error field name
*
* @see \Symfony\Component\Translation\Translator
*/
public function __construct($message, $messageTemplate = null, array $messageParameters = array(), $messagePluralization = null)
public function __construct($message, $messageTemplate = null, array $messageParameters = array(), $messagePluralization = null, $errorPath = null)
{
$this->message = $message;
$this->messageTemplate = $messageTemplate ?: $message;
$this->messageParameters = $messageParameters;
$this->messagePluralization = $messagePluralization;
$this->errorPath = $errorPath;
}

/**
Expand Down Expand Up @@ -102,4 +110,14 @@ public function getMessagePluralization()
{
return $this->messagePluralization;
}

/**
* Returns the error field name
*
* @return string
*/
public function getErrorPath()
{
return $this->errorPath;
}
}