Skip to content

Commit 4c6ab7f

Browse files
committed
Merge branch '4.0'
2 parents 81f2a0a + c9a475a commit 4c6ab7f

26 files changed

+80
-100
lines changed

bundles/configuration.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ bundle configuration would look like:
110110
For parameter handling within a dependency injection container see
111111
:doc:`/configuration/using_parameters_in_dic`.
112112

113-
114113
Processing the ``$configs`` Array
115114
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
116115

@@ -264,7 +263,6 @@ In your extension, you can load this and dynamically set its arguments::
264263
$def->replaceArgument(1, $config['twitter']['client_secret']);
265264
}
266265

267-
268266
.. tip::
269267

270268
Instead of calling ``processConfiguration()`` in your extension each time you

components/console/helpers/questionhelper.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ method::
256256
$name = $helper->ask($input, $output, $question);
257257
}
258258

259-
260259
.. caution::
261260

262261
The normalizer is called first and the returned value is used as the input

components/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ The Components
44
.. toctree::
55
:maxdepth: 1
66
:glob:
7-
7+
88
using_components
99
*

components/options_resolver.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,6 @@ is thrown::
376376
For options with more complicated validation schemes, pass a closure which
377377
returns ``true`` for acceptable values and ``false`` for invalid values::
378378

379-
380379
// ...
381380
$resolver->setAllowedValues('transport', function ($value) {
382381
// return true or false

components/property_access.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,5 @@ Or you can pass parameters directly to the constructor (not the recommended way)
450450
// ...
451451
$accessor = new PropertyAccessor(true); // this enables handling of magic __call
452452

453-
454453
.. _Packagist: https://packagist.org/packages/symfony/property-access
455454
.. _The Inflector component: https://github.com/symfony/inflector

components/serializer.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ You can install the component in 2 different ways:
2929
* :doc:`Install it via Composer </components/using_components>` (``symfony/serializer`` on `Packagist`_);
3030
* Use the official Git repository (https://github.com/symfony/serializer).
3131

32-
3332
.. include:: /components/require_autoload.rst.inc
3433

3534
To use the ``ObjectNormalizer``, the :doc:`PropertyAccess component </components/property_access>`

components/validator/metadata.rst

Lines changed: 72 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,72 @@
1-
.. index::
2-
single: Validator; Metadata
3-
4-
Metadata
5-
========
6-
7-
The :class:`Symfony\\Component\\Validator\\Mapping\\ClassMetadata` class
8-
represents and manages all the configured constraints on a given class.
9-
10-
Properties
11-
----------
12-
13-
The Validator component can validate public, protected or private properties.
14-
The following example shows how to validate that the ``$firstName`` property of
15-
the ``Author`` class has at least 3 characters::
16-
17-
// ...
18-
use Symfony\Component\Validator\Mapping\ClassMetadata;
19-
use Symfony\Component\Validator\Constraints as Assert;
20-
21-
class Author
22-
{
23-
private $firstName;
24-
25-
public static function loadValidatorMetadata(ClassMetadata $metadata)
26-
{
27-
$metadata->addPropertyConstraint('firstName', new Assert\NotBlank());
28-
$metadata->addPropertyConstraint(
29-
'firstName',
30-
new Assert\Length(array("min" => 3))
31-
);
32-
}
33-
}
34-
35-
Getters
36-
-------
37-
38-
Constraints can also be applied to the value returned by any public *getter*
39-
method, which are the methods whose names start with ``get``, ``has`` or ``is``.
40-
This feature allows to validate your objects dynamically.
41-
42-
Suppose that, for security reasons, you want to validate that a password field
43-
doesn't match the first name of the user. First, create a public method called
44-
``isPasswordSafe()`` to define this custom validation logic::
45-
46-
public function isPasswordSafe()
47-
{
48-
return $this->firstName !== $this->password;
49-
}
50-
51-
Then, add the Validator component configuration to the class::
52-
53-
// ...
54-
use Symfony\Component\Validator\Mapping\ClassMetadata;
55-
use Symfony\Component\Validator\Constraints as Assert;
56-
57-
class Author
58-
{
59-
public static function loadValidatorMetadata(ClassMetadata $metadata)
60-
{
61-
$metadata->addGetterConstraint('passwordSafe', new Assert\IsTrue(array(
62-
'message' => 'The password cannot match your first name',
63-
)));
64-
}
65-
}
66-
67-
Classes
68-
-------
69-
70-
Some constraints allow to validate the entire object. For example, the
71-
:doc:`Callback </reference/constraints/Callback>` constraint is a generic
72-
constraint that's applied to the class itself.
1+
.. index::
2+
single: Validator; Metadata
3+
4+
Metadata
5+
========
6+
7+
The :class:`Symfony\\Component\\Validator\\Mapping\\ClassMetadata` class
8+
represents and manages all the configured constraints on a given class.
9+
10+
Properties
11+
----------
12+
13+
The Validator component can validate public, protected or private properties.
14+
The following example shows how to validate that the ``$firstName`` property of
15+
the ``Author`` class has at least 3 characters::
16+
17+
// ...
18+
use Symfony\Component\Validator\Mapping\ClassMetadata;
19+
use Symfony\Component\Validator\Constraints as Assert;
20+
21+
class Author
22+
{
23+
private $firstName;
24+
25+
public static function loadValidatorMetadata(ClassMetadata $metadata)
26+
{
27+
$metadata->addPropertyConstraint('firstName', new Assert\NotBlank());
28+
$metadata->addPropertyConstraint(
29+
'firstName',
30+
new Assert\Length(array("min" => 3))
31+
);
32+
}
33+
}
34+
35+
Getters
36+
-------
37+
38+
Constraints can also be applied to the value returned by any public *getter*
39+
method, which are the methods whose names start with ``get``, ``has`` or ``is``.
40+
This feature allows to validate your objects dynamically.
41+
42+
Suppose that, for security reasons, you want to validate that a password field
43+
doesn't match the first name of the user. First, create a public method called
44+
``isPasswordSafe()`` to define this custom validation logic::
45+
46+
public function isPasswordSafe()
47+
{
48+
return $this->firstName !== $this->password;
49+
}
50+
51+
Then, add the Validator component configuration to the class::
52+
53+
// ...
54+
use Symfony\Component\Validator\Mapping\ClassMetadata;
55+
use Symfony\Component\Validator\Constraints as Assert;
56+
57+
class Author
58+
{
59+
public static function loadValidatorMetadata(ClassMetadata $metadata)
60+
{
61+
$metadata->addGetterConstraint('passwordSafe', new Assert\IsTrue(array(
62+
'message' => 'The password cannot match your first name',
63+
)));
64+
}
65+
}
66+
67+
Classes
68+
-------
69+
70+
Some constraints allow to validate the entire object. For example, the
71+
:doc:`Callback </reference/constraints/Callback>` constraint is a generic
72+
constraint that's applied to the class itself.

console/command_in_controller.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Run this command from inside your controller via::
5555

5656
// return the output, don't use if you used NullOutput()
5757
$content = $output->fetch();
58-
58+
5959
// return new Response(""), if you used NullOutput()
6060
return new Response($content);
6161
}

contributing/code/bugs.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ If your problem definitely looks like a bug, report it using the official bug
2626
* Describe the steps needed to reproduce the bug with short code examples
2727
(providing a unit test that illustrates the bug is best);
2828

29-
* If the bug you experienced is not obvious or affects more than one layer,
30-
providing a simple failing unit test may not be sufficient. In this case,
29+
* If the bug you experienced is not obvious or affects more than one layer,
30+
providing a simple failing unit test may not be sufficient. In this case,
3131
please :doc:`provide a reproducer </contributing/code/reproducer>`;
3232

3333
* Give as much detail as possible about your environment (OS, PHP version,

create_framework/front_controller.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ web root directory:
140140
141141
example.com
142142
├── composer.json
143-
├── composer.lock
143+
├── composer.lock
144144
├── src
145145
│ └── pages
146146
│ ├── hello.php

0 commit comments

Comments
 (0)