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 479ac7b

Browse filesBrowse files
committed
Merge branch '2.3' into 2.7
* 2.3: [#6278] small tweak [HttpFoundation] Fix typo for ParameterBag getters Updated third param true to UrlGeneratorInterface::ABSOLUTE_URl in text Generating Absolute URLs fix yaml syntax [#6255] some tweaks Rewrite EventDispatcher introduction Fixed code example some tweaks to the Doctrine registration article mention routing from the database Conflicts: components/event_dispatcher/introduction.rst
2 parents 80cfcff + f60eb6e commit 479ac7b
Copy full SHA for 479ac7b

File tree

Expand file treeCollapse file tree

9 files changed

+164
-260
lines changed
Filter options
Expand file treeCollapse file tree

9 files changed

+164
-260
lines changed

‎book/routing.rst

Copy file name to clipboardExpand all lines: book/routing.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1553,7 +1553,7 @@ Generating Absolute URLs
15531553
~~~~~~~~~~~~~~~~~~~~~~~~
15541554

15551555
By default, the router will generate relative URLs (e.g. ``/blog``). From
1556-
a controller, simply pass ``true`` to the third argument of the ``generateUrl()``
1556+
a controller, simply pass ``UrlGeneratorInterface::ABSOLUTE_URL`` to the third argument of the ``generateUrl()``
15571557
method::
15581558

15591559
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

‎components/event_dispatcher/introduction.rst

Copy file name to clipboardExpand all lines: components/event_dispatcher/introduction.rst
+96-236Lines changed: 96 additions & 236 deletions
Large diffs are not rendered by default.

‎components/http_foundation/introduction.rst

Copy file name to clipboardExpand all lines: components/http_foundation/introduction.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ has some methods to filter the input values:
140140
:method:`Symfony\\Component\\HttpFoundation\\ParameterBag::filter`
141141
Filters the parameter by using the PHP :phpfunction:`filter_var` function.
142142

143-
All getters takes up to three arguments: the first one is the parameter name
143+
All getters take up to three arguments: the first one is the parameter name
144144
and the second one is the default value to return if the parameter does not
145145
exist::
146146

‎cookbook/bundles/installation.rst

Copy file name to clipboardExpand all lines: cookbook/bundles/installation.rst
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,12 @@ The output will look like this:
122122
.. code-block:: text
123123
124124
assetic:
125-
debug: %kernel.debug%
125+
debug: '%kernel.debug%'
126126
use_controller:
127-
enabled: %kernel.debug%
127+
enabled: '%kernel.debug%'
128128
profiler: false
129-
read_from: %kernel.root_dir%/../web
130-
write_to: %assetic.read_from%
129+
read_from: '%kernel.root_dir%/../web'
130+
write_to: '%assetic.read_from%'
131131
java: /usr/bin/java
132132
node: /usr/local/bin/node
133133
node_paths: []

‎cookbook/doctrine/registration_form.rst

Copy file name to clipboardExpand all lines: cookbook/doctrine/registration_form.rst
+17-16Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Your ``User`` entity will probably at least have the following fields:
3535
``plainPassword``
3636
This field is *not* persisted: (notice no ``@ORM\Column`` above it). It
3737
temporarily stores the plain password from the registration form. This field
38-
can be validated then used to populate the ``password`` field.
38+
can be validated and is then used to populate the ``password`` field.
3939

4040
With some validation added, your class may look something like this::
4141

@@ -127,17 +127,18 @@ With some validation added, your class may look something like this::
127127

128128
public function getSalt()
129129
{
130-
// The bcrypt algorithm don't require a separate salt.
130+
// The bcrypt algorithm doesn't require a separate salt.
131131
// You *may* need a real salt if you choose a different encoder.
132132
return null;
133133
}
134134

135135
// other methods, including security methods like getRoles()
136136
}
137137

138-
The ``UserInterface`` requires a few other methods and your ``security.yml`` file
139-
needs to be configured properly to work with the ``User`` entity. For a more full
140-
example, see the :ref:`Entity Provider <security-crete-user-entity>` article.
138+
The :class:`Symfony\\Component\\Security\\Core\\User\\UserInterface` requires
139+
a few other methods and your ``security.yml`` file needs to be configured
140+
properly to work with the ``User`` entity. For a more complete example, see
141+
the :ref:`Entity Provider <security-crete-user-entity>` article.
141142

142143
.. _cookbook-registration-password-max:
143144

@@ -186,7 +187,7 @@ Next, create the form for the ``User`` entity::
186187
public function configureOptions(OptionsResolver $resolver)
187188
{
188189
$resolver->setDefaults(array(
189-
'data_class' => 'AppBundle\Entity\User'
190+
'data_class' => 'AppBundle\Entity\User',
190191
));
191192
}
192193

@@ -201,7 +202,8 @@ There are just three fields: ``email``, ``username`` and ``plainPassword``
201202

202203
.. tip::
203204

204-
To explore more things about the Form component, read :doc:`/book/forms`.
205+
To explore more things about the Form component, read the
206+
:doc:`chapter about forms </book/forms>` in the book.
205207

206208
Handling the Form Submission
207209
----------------------------
@@ -213,12 +215,11 @@ into the database::
213215
// src/AppBundle/Controller/RegistrationController.php
214216
namespace AppBundle\Controller;
215217

216-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
217-
218218
use AppBundle\Form\UserType;
219219
use AppBundle\Entity\User;
220-
use Symfony\Component\HttpFoundation\Request;
221220
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
221+
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
222+
use Symfony\Component\HttpFoundation\Request;
222223

223224
class RegistrationController extends Controller
224225
{
@@ -245,7 +246,7 @@ into the database::
245246
$em->persist($user);
246247
$em->flush();
247248

248-
// ... do any other work - like send them an email, etc
249+
// ... do any other work - like sending them an email, etc
249250
// maybe set a "flash" success message for the user
250251

251252
return $this->redirectToRoute('replace_with_some_route');
@@ -373,8 +374,8 @@ See :doc:`/cookbook/form/form_customization` for more details.
373374
Update your Database Schema
374375
---------------------------
375376

376-
If you've updated the User entity during this tutorial, you have to update your
377-
database schema using this command:
377+
If you've updated the ``User`` entity during this tutorial, you have to update
378+
your database schema using this command:
378379

379380
.. code-block:: bash
380381
@@ -406,9 +407,9 @@ return the ``email`` property::
406407
// ...
407408
}
408409

409-
Next, just update the ``providers`` section of your ``security.yml`` so that Symfony
410-
knows to load your users via the ``email`` property on login. See
411-
:ref:`authenticating-someone-with-a-custom-entity-provider`.
410+
Next, just update the ``providers`` section of your ``security.yml`` file
411+
so that Symfony knows how to load your users via the ``email`` property on
412+
login. See :ref:`authenticating-someone-with-a-custom-entity-provider`.
412413

413414
Adding a "accept terms" Checkbox
414415
--------------------------------

‎cookbook/map.rst.inc

Copy file name to clipboardExpand all lines: cookbook/map.rst.inc
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@
157157
* :doc:`/cookbook/routing/custom_route_loader`
158158
* :doc:`/cookbook/routing/redirect_trailing_slash`
159159
* :doc:`/cookbook/routing/extra_information`
160+
* :doc:`/cookbook/routing/routing_from_database`
160161

161162
* :doc:`Security Authentication (Identifying/Logging in the User) </cookbook/security/index>`
162163

‎cookbook/routing/index.rst

Copy file name to clipboardExpand all lines: cookbook/routing/index.rst
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ Routing
1212
custom_route_loader
1313
redirect_trailing_slash
1414
extra_information
15+
routing_from_database
+41Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
.. index::
2+
single: Routing; Extra Information
3+
4+
Looking up Routes from a Database: Symfony CMF DynamicRouter
5+
============================================================
6+
7+
The core Symfony Routing System is excellent at handling complex sets
8+
of routes. A highly optimized routing cache is dumped during
9+
deployments.
10+
11+
However, when working with large amounts of data that each need a nice
12+
readable URL (e.g. for search engine optimization purposes), the routing
13+
can get slowed down. Additionally, if routes need to be edited by users,
14+
the route cache would need to be rebuilt frequently.
15+
16+
For these cases, the ``DynamicRouter`` offers an alternative approach:
17+
18+
* Routes are stored in a database;
19+
* There is a database index on the path field, the lookup scales to huge
20+
numbers of different routes;
21+
* Writes only affect the index of the database, which is very efficient.
22+
23+
When all routes are known during deploy time and the number is not too
24+
high, using a :doc:`custom route loader <custom_route_loader>` is the
25+
preferred way to add more routes. When working with just one type of
26+
objects, a slug parameter on the object and the ``@ParamConverter``
27+
annotation work fine (see FrameworkExtraBundle_) .
28+
29+
The ``DynamicRouter`` is useful when you need ``Route`` objects with
30+
the full feature set of Symfony. Each route can define a specific
31+
controller so you can decouple the URL structure from your application
32+
logic.
33+
34+
The DynamicRouter comes with built-in support for Doctrine ORM and Doctrine
35+
PHPCR-ODM but offers the ``ContentRepositoryInterface`` to write a custom
36+
loader, e.g. for another database type or a REST API or anything else.
37+
38+
The DynamicRouter is explained in the `Symfony CMF documentation`_.
39+
40+
.. _FrameworkExtraBundle: https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html
41+
.. _`Symfony CMF documentation`: http://symfony.com/doc/master/cmf/book/routing.html

‎cookbook/session/locale_sticky_session.rst

Copy file name to clipboardExpand all lines: cookbook/session/locale_sticky_session.rst
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ how you determine the desired locale from the request::
5454
public static function getSubscribedEvents()
5555
{
5656
return array(
57-
// must be registered before the default Locale listener
58-
KernelEvents::REQUEST => array(array('onKernelRequest', 17)),
57+
// must be registered after the default Locale listener
58+
KernelEvents::REQUEST => array(array('onKernelRequest', 15)),
5959
);
6060
}
6161
}

0 commit comments

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