8000 [Form] Added FormError::getMessage() and use it in Form class · scp/symfony@9e6a10a · GitHub
[go: up one dir, main page]

Skip to content

Commit 9e6a10a

Browse files
committed
[Form] Added FormError::getMessage() and use it in Form class
1 parent f7fb34a commit 9e6a10a

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/Symfony/Component/Form/Form.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ public function getErrorsAsString($level = 0)
733733
{
734734
$errors = '';
735735
foreach ($this->errors as $error) {
736-
$errors .= str_repeat(' ', $level).'ERROR: '.$error->getMessageTemplate()."\n";
736+
$errors .= str_repeat(' ', $level).'ERROR: '.$error->getMessage()."\n";
737737
}
738738

739739
if ($this->hasChildren()) {

src/Symfony/Component/Form/FormError.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ public function __construct($messageTemplate, array $messageParameters = array()
4747
$this->messageParameters = $messageParameters;
4848
}
4949

50+
/**
51+
* Returns the error message
52+
*
53+
* @return string
54+
*/
55+
public function getMessage()
56+
{
57+
return strtr($this->messageTemplate, $this->messageParameters);
58+
}
59+
5060
/**
5161
* Returns the error message template
5262
*

0 commit comments

Comments
 (0)
0