Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2c9eb89

Browse filesBrowse files
committed
Merge branch '4.0'
* 4.0: 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 minor #8310 [DI] add docs for new namespace option (kbond, javiereguiluz) Added a note about controller arguments Documented the new behavior of getGroupSequence() method Fix UrlMatcher::match() URL Updated a diagram to SVG format Added a missing namespace in CacheKernel example fix creating a CacheKernel in HTTP cache documentation
2 parents 0665ada + aee4f13 commit 2c9eb89
Copy full SHA for 2c9eb89

34 files changed

+130
-67
lines changed
-62.8 KB
Binary file not shown.

‎_images/security/authentication-guard-methods.svg

Copy file name to clipboardExpand all lines: _images/security/authentication-guard-methods.svg
+1Lines changed: 1 addition & 0 deletions
Loading
Binary file not shown.

‎components/dom_crawler.rst

Copy file name to clipboardExpand all lines: components/dom_crawler.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ Pass an array of values::
462462
// sets multiple fields at once
463463
$form->setValues(array('multi' => array(
464464
1 => 'value',
465-
'dimensional' => 'an other value'
465+
'dimensional' => 'an other value',
466466
)));
467467

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

‎components/routing.rst

Copy file name to clipboardExpand all lines: components/routing.rst
+1-1Lines 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

Copy file name to clipboardExpand all lines: components/serializer.rst
+9-6Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -550,9 +550,10 @@ There are several types of normalizers available:
550550
directly and through getters, setters, hassers, adders and removers. It supports
551551
calling the constructor during the denormalization process.
552552

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

557558
The ``ObjectNormalizer`` is the most powerful normalizer. It is configured by
558559
default when using the Symfony Standard Edition with the serializer enabled.
@@ -562,8 +563,9 @@ There are several types of normalizers available:
562563
(public methods starting with "get"). It will denormalize data by calling
563564
the constructor and the "setters" (public methods starting with "set").
564565

565-
Objects are normalized to a map of property names (method name stripped of
566-
the "get" prefix and converted to lower case) to property values.
566+
Objects are normalized to a map of property names and values (names are
567+
generated removing the ``get`` prefix from the method name and lowercasing
568+
the first letter; e.g. ``getFirstName()`` -> ``firstName``).
567569

568570
:class:`Symfony\\Component\\Serializer\\Normalizer\\PropertyNormalizer`
569571
This normalizer directly reads and writes public properties as well as
@@ -681,7 +683,8 @@ Circular references are common when dealing with entity relations::
681683
}
682684

683685
To avoid infinite loops, :class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer`
684-
throws a :class:`Symfony\\Component\\Serializer\\Exception\\CircularReferenceException`
686+
or :class:`Symfony\\Component\\Serializer\\Normalizer\\ObjectNormalizer`
687+
throw a :class:`Symfony\\Component\\Serializer\\Exception\\CircularReferenceException`
685688
when such a case is encountered::
686689

687690
$member = new Member();

‎components/translation.rst

Copy file name to clipboardExpand all lines: components/translation.rst
+1-2Lines 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

‎console/style.rst

Copy file name to clipboardExpand all lines: console/style.rst
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,6 @@ of your commands to change their appearance::
369369

370370
// After
371371
$io = new CustomStyle($input, $output);
372-
373372
// ...
374373
}
375374
}

‎doctrine/event_listeners_subscribers.rst

Copy file name to clipboardExpand all lines: doctrine/event_listeners_subscribers.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ managers that use this connection.
7878
$container->autowire(SearchIndexer2::class)
7979
->addTag('doctrine.event_listener', array(
8080
'event' => 'postPersist',
81-
'connection' => 'default'
81+
'connection' => 'default',
8282
))
8383
;
8484
$container->autowire(SearchIndexerSubscriber::class)

‎email/spool.rst

Copy file name to clipboardExpand all lines: email/spool.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ this spool, use the following configuration:
5454
// config/packages/swiftmailer.php
5555
$container->loadFromExtension('swiftmailer', array(
5656
// ...
57-
'spool' => array('type' => 'memory')
57+
'spool' => array('type' => 'memory'),
5858
));
5959
6060
.. _spool-using-a-file:

‎form/inherit_data_option.rst

Copy file name to clipboardExpand all lines: form/inherit_data_option.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ for that::
106106
public function configureOptions(OptionsResolver $resolver)
107107
{
108108
$resolver->setDefaults(array(
109-
'inherit_data' => true
109+
'inherit_data' => true,
110110
));
111111
}
112112
}

‎forms.rst

Copy file name to clipboardExpand all lines: forms.rst
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,13 @@ the choice is ultimately up to you.
699699

700700
$form->get('agreeTerms')->setData(true);
701701

702+
703+
.. note::
704+
705+
The form name is automatically generated from the type class name. If you want
706+
to modify it, use the :method:`Symfony\\Component\\Form\\FormFactoryInterface::createNamed` method.
707+
You can even suppress the name completely by setting it to an empty string.
708+
702709
Final Thoughts
703710
--------------
704711

‎http_cache.rst

Copy file name to clipboardExpand all lines: http_cache.rst
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ but is a great way to start.
8080
To enable the proxy, first create a caching kernel::
8181

8282
// src/CacheKernel.php
83+
namespace App;
84+
8385
use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache;
8486

8587
class CacheKernel extends HttpCache
@@ -93,6 +95,9 @@ caching kernel:
9395
9496
// public/index.php
9597
98+
use App\Kernel;
99+
+ use App\CacheKernel;
100+
96101
// ...
97102
$kernel = new Kernel($_SERVER['APP_ENV'] ?? 'dev', $_SERVER['APP_DEBUG'] ?? ('prod' !== ($_SERVER['APP_ENV'] ?? 'dev')));
98103

‎http_cache/cache_invalidation.rst

Copy file name to clipboardExpand all lines: http_cache/cache_invalidation.rst
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Here is how you can configure the Symfony reverse proxy (See :doc:`/http_cache`)
5151
to support the ``PURGE`` HTTP method::
5252

5353
// src/CacheKernel.php
54+
namespace App;
5455

5556
use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache;
5657
use Symfony\Component\HttpFoundation\Request;

‎http_cache/validation.rst

Copy file name to clipboardExpand all lines: http_cache/validation.rst
+1-1Lines 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
}

‎reference/configuration/framework.rst

Copy file name to clipboardExpand all lines: reference/configuration/framework.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1410,7 +1410,7 @@ configure this like:
14101410
'templating' => array(
14111411
'form' => array(
14121412
'resources' => array(
1413-
'form_themes'
1413+
'form_themes',
14141414
),
14151415
),
14161416
),

‎reference/configuration/security.rst

Copy file name to clipboardExpand all lines: reference/configuration/security.rst
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -720,11 +720,11 @@ multiple firewalls, the "context" could actually be shared:
720720
'firewalls' => array(
721721
'somename' => array(
722722
// ...
723-
'context' => 'my_context'
723+
'context' => 'my_context',
724724
),
725725
'othername' => array(
726726
// ...
727-
'context' => 'my_context'
727+
'context' => 'my_context',
728728
),
729729
),
730730
));

‎reference/constraints/CardScheme.rst

Copy file name to clipboardExpand all lines: reference/constraints/CardScheme.rst
+1-1Lines 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

Copy file name to clipboardExpand all lines: reference/constraints/Isbn.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ on an object that will contain an ISBN.
8989
{
9090
$metadata->addPropertyConstraint('isbn', new Assert\Isbn(array(
9191
'type' => 'isbn10',
92-
'message' => 'This value is not valid.'
92+
'message' => 'This value is not valid.',
9393
)));
9494
}
9595
}

‎reference/forms/types/collection.rst

Copy file name to clipboardExpand all lines: reference/forms/types/collection.rst
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ address as its own input text box::
5959

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

‎reference/forms/types/date.rst

Copy file name to clipboardExpand all lines: reference/forms/types/date.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ values for the year, month and day fields::
152152

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

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

Copy file name to clipboardExpand all lines: reference/forms/types/options/group_by.rst.inc
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Take the following example::
2020
'now' => new \DateTime('now'),
2121
'tomorrow' => new \DateTime('+1 day'),
2222
'1 week' => new \DateTime('+1 week'),
23-
'1 month' => new \DateTime('+1 month')
23+
'1 month' => new \DateTime('+1 month'),
2424
),
2525
'group_by' => function($val, $key, $index) {
2626
if ($val <= new \DateTime('+3 days')) {

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

Copy file name to clipboardExpand all lines: reference/forms/types/options/preferred_choices.rst.inc
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ 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
),
20-
'preferred_choices' => array('muppets', 'arr')
20+
'preferred_choices' => array('muppets', 'arr'),
2121
));
2222

2323
This options can also be a callback function to give you more flexibility. This might
@@ -31,7 +31,7 @@ be especially useful if your values are objects::
3131
'now' => new \DateTime('now'),
3232
'tomorrow' => new \DateTime('+1 day'),
3333
'1 week' => new \DateTime('+1 week'),
34-
'1 month' => new \DateTime('+1 month')
34+
'1 month' => new \DateTime('+1 month'),
3535
),
3636
'preferred_choices' => function ($val, $key) {
3737
// prefer options within 3 days

‎routing/requirements.rst

Copy file name to clipboardExpand all lines: routing/requirements.rst
+1-1Lines 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' => 'App\Controller\BlogController::list',
6767
), array(
68-
'page' => '\d+'
68+
'page' => '\d+',
6969
)));
7070
7171
// ...

‎security/access_control.rst

Copy file name to clipboardExpand all lines: security/access_control.rst
+2-2Lines 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.rst

Copy file name to clipboardExpand all lines: security/csrf.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ After this, you have protected your login form against CSRF attacks.
269269
'form_login' => array(
270270
// ...
271271
'csrf_parameter' => '_csrf_security_token',
272-
'csrf_token_id' => 'a_private_string'
272+
'csrf_token_id' => 'a_private_string',
273273
),
274274
),
275275
),

‎security/entity_provider.rst

Copy file name to clipboardExpand all lines: security/entity_provider.rst
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,14 +369,14 @@ so you only need the new interface::
369369
{
370370
return serialize(array(
371371
// ...
372-
$this->isActive
372+
$this->isActive,
373373
));
374374
}
375375
public function unserialize($serialized)
376376
{
377377
list (
378378
// ...
379-
$this->isActive
379+
$this->isActive,
380380
) = unserialize($serialized);
381381
}
382382
}

‎security/form_login_setup.rst

Copy file name to clipboardExpand all lines: security/form_login_setup.rst
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ Great! Next, add the logic to ``login()`` that displays the login form::
158158
));
159159
}
160160

161+
.. note::
162+
163+
If you get an error that the ``$authUtils`` argument is missing, it's
164+
probably because you need to activate this new feature in Symfony 3.4. See
165+
this :ref:`controller service argument note <controller-service-arguments-tag>`.
166+
161167
Don't let this controller confuse you. As you'll see in a moment, when the
162168
user submits the form, the security system automatically handles the form
163169
submission for you. If the user submits an invalid username or password,

‎security/guard_authentication.rst

Copy file name to clipboardExpand all lines: security/guard_authentication.rst
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,9 @@ Each authenticator needs the following methods:
417417

418418
The picture below shows how Symfony calls Guard Authenticator methods:
419419

420-
.. image:: /_images/security/authentication-guard-methods.png
421-
:align: center
420+
.. raw:: html
421+
422+
<object data="../_images/security/authentication-guard-methods.svg" type="image/svg+xml"></object>
422423

423424
.. _guard-customize-error:
424425

‎security/impersonating_user.rst

Copy file name to clipboardExpand all lines: security/impersonating_user.rst
+21-21Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -198,32 +198,32 @@ The :doc:`/session/locale_sticky_session` article does not update the locale
198198
when you impersonate a user. If you *do* want to be sure to update the locale when
199199
you switch users, add an event subscriber on this event::
200200

201-
// src/EventListener/SwitchUserListener.php
202-
namespace App\EventListener;
201+
// src/EventListener/SwitchUserListener.php
202+
namespace App\EventListener;
203203

204-
use Symfony\Component\Security\Http\Event\SwitchUserEvent;
205-
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
206-
use Symfony\Component\Security\Http\SecurityEvents;
204+
use Symfony\Component\Security\Http\Event\SwitchUserEvent;
205+
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
206+
use Symfony\Component\Security\Http\SecurityEvents;
207207

208-
class SwitchUserSubscriber implements EventSubscriberInterface
208+
class SwitchUserSubscriber implements EventSubscriberInterface
209+
{
210+
public function onSwitchUser(SwitchUserEvent $event)
209211
{
210-
public function onSwitchUser(SwitchUserEvent $event)
211-
{
212-
$event->getRequest()->getSession()->set(
213-
'_locale',
214-
// assuming your User has some getLocale() method
215-
$event->getTargetUser()->getLocale()
216-
);
217-
}
212+
$event->getRequest()->getSession()->set(
213+
'_locale',
214+
// assuming your User has some getLocale() method
215+
$event->getTargetUser()->getLocale()
216+
);
217+
}
218218

219-
public static function getSubscribedEvents()
220-
{
221-
return array(
222-
// constant for security.switch_user
223-
SecurityEvents::SWITCH_USER => 'onSwitchUser',
224-
);
225-
}
219+
public static function getSubscribedEvents()
220+
{
221+
return array(
222+
// constant for security.switch_user
223+
SecurityEvents::SWITCH_USER => 'onSwitchUser',
224+
);
226225
}
226+
}
227227

228228
That's it! If you're using the :ref:`default services.yaml configuration <service-container-services-load-example>`,
229229
Symfony will automatically discover your service and call ``onSwitchUser`` whenever

‎security/named_encoders.rst

Copy file name to clipboardExpand all lines: security/named_encoders.rst
+2-2Lines 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
));
@@ -174,7 +174,7 @@ you must register a service for it in order to use it as a named encoder:
174174
// ...
175175
'encoders' => array(
176176
'app_encoder' => array(
177-
'id' => MyCustomPasswordEncoder::class
177+
'id' => MyCustomPasswordEncoder::class,
178178
),
179179
),
180180
));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.