Skip to content

Commit 5ea29a5

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: Fix missing trailling commas [Serializer] Added missing ObjectNormalizer [Serializer] By default the serializer do not convert to lower case properties Added a note about named form types Update translation.rst Fix UrlMatcher::match() URL
2 parents e808790 + 5242e92 commit 5ea29a5

35 files changed

+57
-52
lines changed

best_practices/controllers.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ for the homepage of our app:
111111
->findLatest();
112112
113113
return $this->render('default/index.html.twig', array(
114-
'posts' => $posts
114+
'posts' => $posts,
115115
));
116116
}
117117
}

best_practices/forms.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ some developers configure form buttons in the controller::
126126
$form = $this->createForm(PostType::class, $post);
127127
$form->add('submit', SubmitType::class, array(
128128
'label' => 'Create',
129-
'attr' => array('class' => 'btn btn-default pull-right')
129+
'attr' => array('class' => 'btn btn-default pull-right'),
130130
));
131131

132132
// ...

components/dom_crawler.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ Pass an array of values::
384384
// sets multiple fields at once
385385
$form->setValues(array('multi' => array(
386386
1 => 'value',
387-
'dimensional' => 'an other value'
387+
'dimensional' => 'an other value',
388388
)));
389389

390390
This is great, but it gets better! The ``Form`` object allows you to interact

components/http_foundation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ class, which can make this even easier::
557557

558558
$response = new JsonResponse();
559559
$response->setData(array(
560-
'data' => 123
560+
'data' => 123,
561561
));
562562

563563
This encodes your array of data to JSON and sets the ``Content-Type`` header

components/routing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ URL path and some array of custom variables in its constructor. This array
6262
of custom variables can be *anything* that's significant to your application,
6363
and is returned when that route is matched.
6464

65-
The :method:`UrlMatcher::match() <Symfony\\Component\\Routing\\UrlMatcher::match>`
65+
The :method:`UrlMatcher::match() <Symfony\\Component\\Routing\\Matcher\\UrlMatcher::match>`
6666
returns the variables you set on the route as well as the wildcard placeholders
6767
(see below). Your application can now use this information to continue
6868
processing the request. In addition to the configured variables, a ``_route``

components/serializer.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -512,9 +512,10 @@ There are several types of normalizers available:
512512
directly and through getters, setters, hassers, adders and removers. It supports
513513
calling the constructor during the denormalization process.
514514

515-
Objects are normalized to a map of property names (method name stripped of
516-
the "get"/"set"/"has"/"remove" prefix and converted to lower case) to property
517-
values.
515+
Objects are normalized to a map of property names and values (names are
516+
generated removing the ``get``, ``set``, ``has`` or ``remove`` prefix from
517+
the method name and lowercasing the first letter; e.g. ``getFirstName()`` ->
518+
``firstName``).
518519

519520
The ``ObjectNormalizer`` is the most powerful normalizer. It is configured by
520521
default when using the Symfony Standard Edition with the serializer enabled.
@@ -524,8 +525,9 @@ There are several types of normalizers available:
524525
(public methods starting with "get"). It will denormalize data by calling
525526
the constructor and the "setters" (public methods starting with "set").
526527

527-
Objects are normalized to a map of property names (method name stripped of
528-
the "get" prefix and converted to lower case) to property values.
528+
Objects are normalized to a map of property names and values (names are
529+
generated removing the ``get`` prefix from the method name and lowercasing
530+
the first letter; e.g. ``getFirstName()`` -> ``firstName``).
529531

530532
:class:`Symfony\\Component\\Serializer\\Normalizer\\PropertyNormalizer`
531533
This normalizer directly reads and writes public properties as well as
@@ -596,7 +598,8 @@ Circular references are common when dealing with entity relations::
596598
}
597599

598600
To avoid infinite loops, :class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer`
599-
throws a :class:`Symfony\\Component\\Serializer\\Exception\\CircularReferenceException`
601+
or :class:`Symfony\\Component\\Serializer\\Normalizer\\ObjectNormalizer`
602+
throw a :class:`Symfony\\Component\\Serializer\\Exception\\CircularReferenceException`
600603
when such a case is encountered::
601604

602605
$member = new Member();

components/translation.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@ The constructor of the ``Translator`` class needs one argument: The locale.
3434
.. code-block:: php
3535
3636
use Symfony\Component\Translation\Translator;
37-
use Symfony\Component\Translation\MessageSelector;
3837
39-
$translator = new Translator('fr_FR', new MessageSelector());
38+
$translator = new Translator('fr_FR');
4039
4140
.. note::
4241

configuration/environments.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ configuration file:
139139
140140
$container->loadFromExtension('web_profiler', array(
141141
'toolbar' => true,
142-
143142
// ...
144143
));
145144

console/style.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,6 @@ of your commands to change their appearance::
372372

373373
// After
374374
$io = new CustomStyle($input, $output);
375-
376375
// ...
377376
}
378377
}

doctrine/event_listeners_subscribers.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ managers that use this connection.
106106
->register('my.listener2', SearchIndexer2::class)
107107
->addTag('doctrine.event_listener', array(
108108
'event' => 'postPersist',
109-
'connection' => 'default'
109+
'connection' => 'default',
110110
))
111111
;
112112
$container

email/spool.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ swiftmailer with the memory option, use the following configuration:
5252
// app/config/config.php
5353
$container->loadFromExtension('swiftmailer', array(
5454
// ...
55-
'spool' => array('type' => 'memory')
55+
'spool' => array('type' => 'memory'),
5656
));
5757
5858
.. _spool-using-a-file:

form/form_dependencies.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ create your form::
3838
{
3939
$task = ...;
4040
$form = $this->createForm(TaskType::class, $task, array(
41-
'entity_manager' => $this->get('doctrine.orm.entity_manager')
41+
'entity_manager' => $this->get('doctrine.orm.entity_manager'),
4242
));
4343

4444
// ...

form/inherit_data_option.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ for that::
110110
public function configureOptions(OptionsResolver $resolver)
111111
{
112112
$resolver->setDefaults(array(
113-
'inherit_data' => true
113+
'inherit_data' => true,
114114
));
115115
}
116116
}

forms.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,13 @@ the choice is ultimately up to you.
702702

703703
$form->get('agreeTerms')->setData(true);
704704

705+
706+
.. note::
707+
708+
The form name is automatically generated from the type class name. If you want
709+
to modify it, use the :method:`Symfony\\Component\\Form\\FormFactoryInterface::createNamed` method.
710+
You can even suppress the name completely by setting it to an empty string.
711+
705712
Final Thoughts
706713
--------------
707714

http_cache/validation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ exposing a simple and efficient pattern::
218218
// or render a template with the $response you've already started
219219
return $this->render('article/show.html.twig', array(
220220
'article' => $article,
221-
'comments' => $comments
221+
'comments' => $comments,
222222
), $response);
223223
}
224224
}

quick_tour/the_controller.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ a new method called ``helloAction()`` with the following content::
7070
public function helloAction($name)
7171
{
7272
return $this->render('default/hello.html.twig', array(
73-
'name' => $name
73+
'name' => $name,
7474
));
7575
}
7676
}
@@ -125,7 +125,7 @@ as its default value::
125125
public function helloAction($name, $_format)
126126
{
127127
return $this->render('default/hello.'.$_format.'.twig', array(
128-
'name' => $name
128+
'name' => $name,
129129
));
130130
}
131131

@@ -168,7 +168,7 @@ option of the ``@Route()`` annotation::
168168
public function helloAction($name, $_format)
169169
{
170170
return $this->render('default/hello.'.$_format.'.twig', array(
171-
'name' => $name
171+
'name' => $name,
172172
));
173173
}
174174

quick_tour/the_view.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ on its type:
6868
6969
{# 1. Simple variables #}
7070
{# $this->render('template.html.twig', array(
71-
'name' => 'Fabien')
72-
) #}
71+
'name' => 'Fabien',
72+
)) #}
7373
{{ name }}
7474
7575
{# 2. Arrays #}

reference/configuration/framework.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1328,7 +1328,7 @@ Assume you have custom global form themes in
13281328
'templating' => array(
13291329
'form' => array(
13301330
'resources' => array(
1331-
'WebsiteBundle:Form'
1331+
'WebsiteBundle:Form',
13321332
),
13331333
),
13341334
),

reference/configuration/security.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -675,11 +675,11 @@ multiple firewalls, the "context" could actually be shared:
675675
'firewalls' => array(
676676
'somename' => array(
677677
// ...
678-
'context' => 'my_context'
678+
'context' => 'my_context',
679679
),
680680
'othername' => array(
681681
// ...
682-
'context' => 'my_context'
682+
'context' => 'my_context',
683683
),
684684
),
685685
));

reference/constraints/CardScheme.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ on an object that will contain a credit card number.
8989
{
9090
$metadata->addPropertyConstraint('cardNumber', new Assert\CardScheme(array(
9191
'schemes' => array(
92-
'VISA'
92+
'VISA',
9393
),
9494
'message' => 'Your credit card number is invalid.',
9595
)));

reference/constraints/Isbn.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ on an object that will contain an ISBN.
9999
{
100100
$metadata->addPropertyConstraint('isbn', new Assert\Isbn(array(
101101
'type' => 'isbn10',
102-
'message' => 'This value is not valid.'
102+
'message' => 'This value is not valid.',
103103
)));
104104
}
105105
}

reference/forms/types/collection.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ address as its own input text box::
6060

6161
$builder->add('emails', CollectionType::class, array(
6262
// each entry in the array will be an "email" field
63-
'entry_type' => EmailType::class,
63+
'entry_type' => EmailType::class,
6464
// these options are passed to each "email" type
65-
'entry_options' => array(
66-
'attr' => array('class' => 'email-box')
65+
'entry_options' => array(
66+
'attr' => array('class' => 'email-box'),
6767
),
6868
));
6969

@@ -211,7 +211,7 @@ And update the template as follows:
211211
{% endfor %}
212212
</ul>
213213
214-
<a href="#"
214+
<a href="#"
215215
class="add-another-collection-widget"
216216
data-list="#email-field-list">Add another email</a>
217217

reference/forms/types/date.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ values for the year, month and day fields::
153153

154154
$builder->add('dueDate', DateType::class, array(
155155
'placeholder' => array(
156-
'year' => 'Year', 'month' => 'Month', 'day' => 'Day'
156+
'year' => 'Year', 'month' => 'Month', 'day' => 'Day',
157157
)
158158
));
159159

reference/forms/types/options/group_by.rst.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Take the following example::
2323
'now' => new \DateTime('now'),
2424
'tomorrow' => new \DateTime('+1 day'),
2525
'1 week' => new \DateTime('+1 week'),
26-
'1 month' => new \DateTime('+1 month')
26+
'1 month' => new \DateTime('+1 month'),
2727
),
2828
'choices_as_values' => true,
2929
'group_by' => function($val, $key, $index) {

reference/forms/types/options/preferred_choices.rst.inc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ you can list the most popular on top, like Bork Bork and Pirate::
1515
'English' => 'en',
1616
'Spanish' => 'es',
1717
'Bork' => 'muppets',
18-
'Pirate' => 'arr'
18+
'Pirate' => 'arr',
1919
),
2020
'choices_as_values' => true,
21-
'preferred_choices' => array('muppets', 'arr')
21+
'preferred_choices' => array('muppets', 'arr'),
2222
));
2323

2424
.. versionadded:: 2.7
@@ -35,7 +35,7 @@ be especially useful if your values are objects::
3535
'now' => new \DateTime('now'),
3636
'tomorrow' => new \DateTime('+1 day'),
3737
'1 week' => new \DateTime('+1 week'),
38-
'1 month' => new \DateTime('+1 month')
38+
'1 month' => new \DateTime('+1 month'),
3939
),
4040
'choices_as_values' => true,
4141
'preferred_choices' => function ($val, $key) {

routing/requirements.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ a routing ``{wildcard}`` to only match some regular expression:
6565
$collection->add('blog_list', new Route('/blog/{page}', array(
6666
'_controller' => 'AppBundle:Blog:list',
6767
), array(
68-
'page' => '\d+'
68+
'page' => '\d+',
6969
)));
7070
7171
// ...

security/access_control.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,11 @@ pattern so that it is only accessible by requests from the local server itself:
209209
array(
210210
'path' => '^/internal',
211211
'role' => 'IS_AUTHENTICATED_ANONYMOUSLY',
212-
'ips' => '127.0.0.1, ::1'
212+
'ips' => '127.0.0.1, ::1',
213213
),
214214
array(
215215
'path' => '^/internal',
216-
'role' => 'ROLE_NO_ACCESS'
216+
'role' => 'ROLE_NO_ACCESS',
217217
),
218218
),
219219
));

security/csrf_in_login_form.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ After this, you have protected your login form against CSRF attacks.
211211
'form_login' => array(
212212
// ...
213213
'csrf_parameter' => '_csrf_security_token',
214-
'csrf_token_id' => 'a_private_string'
214+
'csrf_token_id' => 'a_private_string',
215215
),
216216
),
217217
),

security/entity_provider.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,14 +375,14 @@ so you only need the new interface::
375375
{
376376
return serialize(array(
377377
// ...
378-
$this->isActive
378+
$this->isActive,
379379
));
380380
}
381381
public function unserialize($serialized)
382382
{
383383
list (
384384
// ...
385-
$this->isActive
385+
$this->isActive,
386386
) = unserialize($serialized);
387387
}
388388
}

security/impersonating_user.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ the sticky locale:
228228
->register('app.switch_user_listener', SwitchUserListener::class)
229229
->addTag('kernel.event_listener', array(
230230
'event' => 'security.switch_user',
231-
'method' => 'onSwitchUser'
231+
'method' => 'onSwitchUser',
232232
))
233233
;
234234

security/named_encoders.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ named encoders:
9696
'encoders' => array(
9797
'harsh' => array(
9898
'algorithm' => 'bcrypt',
99-
'cost' => '15'
99+
'cost' => '15',
100100
),
101101
),
102102
));
@@ -165,7 +165,7 @@ you must register a service for it in order to use it as a named encoder:
165165
// ...
166166
'encoders' => array(
167167
'app_encoder' => array(
168-
'id' => 'app.password_encoder_service'
168+
'id' => 'app.password_encoder_service',
169169
),
170170
),
171171
));

service_container/definitions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ fetched from the container::
7979

8080
$definition = new Definition(DoctrineConfigManager::class, array(
8181
new Reference('doctrine'), // a reference to another service
82-
'%app.config_table_name%' // will be resolved to the value of a container parameter
82+
'%app.config_table_name%', // will be resolved to the value of a container parameter
8383
));
8484

8585
// gets all arguments configured for this definition

0 commit comments

Comments
 (0)