Skip to content

Commit

Permalink
Merge branch '2.7' into 2.8
Browse files Browse the repository at this point in the history
* 2.7:
  tweaks for 2.7
  Fixing build error
  Tweaks thanks to everyone!
  [WIP] Reworking most of the registration form:
  Fixing build problems and wrong links
  changing includes to links
  Updating book examples to not use deprecated validation methods
  Updated constraint reference docs for Null->IsNull, False->IsFalse, True->IsTrue
  Creating placeholder constraint rst docs for deprecated usage
  Renaming constraint rst files to Is* to preserve edit history
  Fixes thanks to Stof
  fixing build failure
  Tweaks - see symfony#5314
  • Loading branch information
weaverryan committed Oct 15, 2015
2 parents 21931ed + b6e61ca commit 3787061
Show file tree
Hide file tree
Showing 14 changed files with 596 additions and 540 deletions.
8 changes: 4 additions & 4 deletions book/validation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ this method must return ``true``:
class Author
{
/**
* @Assert\True(message = "The password cannot match your first name")
* @Assert\IsTrue(message = "The password cannot match your first name")
*/
public function isPasswordLegal()
{
Expand Down Expand Up @@ -675,7 +675,7 @@ this method must return ``true``:
{
public static function loadValidatorMetadata(ClassMetadata $metadata)
{
$metadata->addGetterConstraint('passwordLegal', new Assert\True(array(
$metadata->addGetterConstraint('passwordLegal', new Assert\IsTrue(array(
'message' => 'The password cannot match your first name',
)));
}
Expand Down Expand Up @@ -937,7 +937,7 @@ username and the password are different only if all other validation passes
private $password;
/**
* @Assert\True(message="The password cannot match your username", groups={"Strict"})
* @Assert\IsTrue(message="The password cannot match your username", groups={"Strict"})
*/
public function isPasswordLegal()
{
Expand Down Expand Up @@ -1011,7 +1011,7 @@ username and the password are different only if all other validation passes
$metadata->addPropertyConstraint('username', new Assert\NotBlank());
$metadata->addPropertyConstraint('password', new Assert\NotBlank());
$metadata->addGetterConstraint('passwordLegal', new Assert\True(array(
$metadata->addGetterConstraint('passwordLegal', new Assert\IsTrue(array(
'message' => 'The password cannot match your first name',
'groups' => array('Strict'),
)));
Expand Down
11 changes: 11 additions & 0 deletions components/config/definition.rst
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ Before defining the children of an array node, you can provide options like:
``addDefaultsIfNotSet()``
If any child nodes have default values, use them if explicit values
haven't been provided.
``normalizeKeys(false)``
If called (with ``false``), keys with dashes are *not* normalized to underscores.
It is recommended to use this with prototype nodes where the user will define
a key-value map, to avoid an unnecessary transformation.

A basic prototyped array configuration can be defined as follows::

Expand Down Expand Up @@ -303,6 +307,13 @@ The output configuration will be exactly the same as before. In other words, the
``sf_connection`` and ``default`` configuration keys are lost. The reason is that
the Symfony Config component treats arrays as lists by default.

.. note::

As of writing this, there is an inconsistency: if only one file provides the
configuration in question, the keys (i.e. ``sf_connection`` and ``default``)
are *not* lost. But if more than one file provides the configuration, the keys
are lost as described above.

In order to maintain the array keys use the ``useAttributeAsKey()`` method::

$node
Expand Down
Loading

0 comments on commit 3787061

Please sign in to comment.