Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Validator] changed the convention for placeholders in messages to be…
… compatible with Twig (from %limit% to {{ limit }})
  • Loading branch information
fabpot committed Sep 27, 2010
1 parent 8152c78 commit 466ef9c
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion ConstraintViolation.php
Expand Up @@ -34,7 +34,7 @@ public function getMessage()
$sources = array();
$targets = array();
foreach ($this->messageParameters as $key => $value) {
$sources[] = '%'.$key.'%';
$sources[] = '{{ '.$key.' }}';
$targets[] = (string) $value;
}

Expand Down
2 changes: 1 addition & 1 deletion Constraints/AssertType.php
Expand Up @@ -4,7 +4,7 @@

class AssertType extends \Symfony\Component\Validator\Constraint
{
public $message = 'This value should be of type %type%';
public $message = 'This value should be of type {{ type }}';
public $type;

/**
Expand Down
4 changes: 2 additions & 2 deletions Constraints/Choice.php
Expand Up @@ -18,8 +18,8 @@ class Choice extends \Symfony\Component\Validator\Constraint
public $min = null;
public $max = null;
public $message = 'This value should be one of the given choices';
public $minMessage = 'You should select at least %limit% choices';
public $maxMessage = 'You should select at most %limit% choices';
public $minMessage = 'You should select at least {{ limit }} choices';
public $maxMessage = 'You should select at most {{ limit }} choices';

/**
* {@inheritDoc}
Expand Down
4 changes: 2 additions & 2 deletions Constraints/Collection.php
Expand Up @@ -7,8 +7,8 @@ class Collection extends \Symfony\Component\Validator\Constraint
public $fields;
public $allowExtraFields = false;
public $allowMissingFields = false;
public $extraFieldsMessage = 'The fields %fields% were not expected';
public $missingFieldsMessage = 'The fields %fields% are missing';
public $extraFieldsMessage = 'The fields {{ fields }} were not expected';
public $missingFieldsMessage = 'The fields {{ fields }} are missing';

public function requiredOptions()
{
Expand Down
4 changes: 2 additions & 2 deletions Constraints/File.php
Expand Up @@ -8,6 +8,6 @@ class File extends \Symfony\Component\Validator\Constraint
public $mimeTypes = array();
public $notFoundMessage = 'The file could not be found';
public $notReadableMessage = 'The file is not readable';
public $maxSizeMessage = 'The file is too large (%size%). Allowed maximum size is %limit%';
public $mimeTypesMessage = 'The mime type of the file is invalid (%type%). Allowed mime types are %types%';
public $maxSizeMessage = 'The file is too large ({{ size }}). Allowed maximum size is {{ limit }}';
public $mimeTypesMessage = 'The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}';
}
2 changes: 1 addition & 1 deletion Constraints/Max.php
Expand Up @@ -4,7 +4,7 @@

class Max extends \Symfony\Component\Validator\Constraint
{
public $message = 'This value should be %limit% or less';
public $message = 'This value should be {{ limit }} or less';
public $limit;

/**
Expand Down
2 changes: 1 addition & 1 deletion Constraints/MaxLength.php
Expand Up @@ -4,7 +4,7 @@

class MaxLength extends \Symfony\Component\Validator\Constraint
{
public $message = 'This value is too long. It should have %limit% characters or less';
public $message = 'This value is too long. It should have {{ limit }} characters or less';
public $limit;
public $charset = 'UTF-8';

Expand Down
2 changes: 1 addition & 1 deletion Constraints/Min.php
Expand Up @@ -4,7 +4,7 @@

class Min extends \Symfony\Component\Validator\Constraint
{
public $message = 'This value should be %limit% or more';
public $message = 'This value should be {{ limit }} or more';
public $limit;

/**
Expand Down
2 changes: 1 addition & 1 deletion Constraints/MinLength.php
Expand Up @@ -4,7 +4,7 @@

class MinLength extends \Symfony\Component\Validator\Constraint
{
public $message = 'This value is too short. It should have %limit% characters or more';
public $message = 'This value is too short. It should have {{ limit }} characters or more';
public $limit;
public $charset = 'UTF-8';

Expand Down
2 changes: 1 addition & 1 deletion Constraints/Valid.php
Expand Up @@ -4,6 +4,6 @@

class Valid extends \Symfony\Component\Validator\Constraint
{
public $message = 'This value should be instance of class %class%';
public $message = 'This value should be instance of class {{ class }}';
public $class;
}

0 comments on commit 466ef9c

Please sign in to comment.