Skip to content

Commit

Permalink
[Form] Added FormError::getMessage() and use it in Form class
Browse files Browse the repository at this point in the history
  • Loading branch information
francisbesset committed Nov 29, 2011
1 parent f7fb34a commit 9e6a10a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Symfony/Component/Form/Form.php
Expand Up @@ -733,7 +733,7 @@ public function getErrorsAsString($level = 0)
{
$errors = '';
foreach ($this->errors as $error) {
$errors .= str_repeat(' ', $level).'ERROR: '.$error->getMessageTemplate()."\n";
$errors .= str_repeat(' ', $level).'ERROR: '.$error->getMessage()."\n";
}

if ($this->hasChildren()) {
Expand Down
10 changes: 10 additions & 0 deletions src/Symfony/Component/Form/FormError.php
Expand Up @@ -47,6 +47,16 @@ public function __construct($messageTemplate, array $messageParameters = array()
$this->messageParameters = $messageParameters;
}

/**
* Returns the error message
*
* @return string
*/
public function getMessage()
{
return strtr($this->messageTemplate, $this->messageParameters);
}

/**
* Returns the error message template
*
Expand Down

0 comments on commit 9e6a10a

Please sign in to comment.