8000 Merge branch '2.3' into 2.4 · symfony/symfony-docs@080a769 · GitHub
[go: up one dir, main page]

Skip to content

Commit 080a769

Browse files 8000
committed
Merge branch '2.3' into 2.4
2 parents e8511cb + 0cb9c3b commit 080a769

File tree

3 files changed

+51
-34
lines changed

3 files changed

+51
-34
lines changed

book/routing.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ The route is simple:
7575
The path defined by the ``blog_show`` route acts like ``/blog/*`` where
7676
the wildcard is given the name ``slug``. For the URL ``/blog/my-blog-post``,
7777
the ``slug`` variable gets a value of ``my-blog-post``, which is available
78-
for you to use in your controller (keep reading).
78+
for you to use in your controller (keep reading). The ``blog_show`` is the
79+
internal name of the route, which doesn't have any meaning yet and just needs
80+
to be unique. Later, you'll use it to generate URLs.
7981

8082
The ``_controller`` parameter is a special key that tells Symfony which controller
8183
should be executed when a URL matches this route. The ``_controller`` string

components/security/authentication.rst

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -237,20 +237,34 @@ method of the password encoder factory is called with the user object as
237237
its first argument, it will return an encoder of type :class:`Symfony\\Component\\Security\\Core\\Encoder\\PasswordEncoderInterface`
238238
which should be used to encode this user's password::
239239

240-
// fetch a user of type Acme\Entity\LegacyUser
241-
$user = ...
240+
// a Acme\Entity\LegacyUser instance
241+
$user = ...;
242+
243+
// the password that was submitted, e.g. when registering
244+
$plainPassword = ...;
242245

243246
$encoder = $encoderFactory->getEncoder($user);
244247

245248
// will return $weakEncoder (see above)
249+
$encodedPassword = $encoder->encodePassword($plainPassword, $user->getSalt());
250+
251+
$user->setPassword($encodedPassword);
246252

247-
$encodedPassword = $encoder->encodePassword($password, $user->getSalt());
253+
// ... save the user
248254

249-
// check if the password is valid:
255+
Now, when you want to check if the submitted password (e.g. when trying to log
256+
in) is correct, you can use::
257+
258+
// fetch the Acme\Entity\LegacyUser
259+
$user = ...;
260+
261+
// the submitted password, e.g. from the login form
262+
$plainPassword = ...;
250263

251264
$validPassword = $encoder->isPasswordValid(
252-
$user->getPassword(),
253-
$password,
254-
$user->getSalt());
265+
$user->getPassword(), // the encoded password
266+
$plainPassword, // the submitted password
267+
$user->getSalt()
268+
);
255269

256270
.. _`CVE-2013-5750`: http://symfony.com/blog/cve-2013-5750-security-issue-in-fosuserbundle-login-form

cookbook/workflow/new_project_git.rst

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,51 +20,51 @@ Initial Project Setup
2020
To get started, you'll need to download Symfony and initialize your local
2121
git repository:
2222

23-
1. Download the `Symfony2 Standard Edition`_ without vendors.
23+
#. Download the `Symfony2 Standard Edition`_ using Composer:
2424

25-
2. Unzip/untar the distribution. It will create a folder called Symfony with
26-
your new project structure, config files, etc. Rename it to whatever you like.
27-
28-
3. Create a new file called ``.gitignore`` at the root of your new project
29-
(e.g. next to the ``composer.json`` file) and paste the following into it. Files
30-
matching these patterns will be ignored by Git:
31-
32-
.. code-block:: text
33-
34-
/web/bundles/
35-
/app/bootstrap*
36-
/app/cache/*
37-
/app/logs/*
38-
/vendor/
39-
/app/config/parameters.yml
25+
.. code-block:: bash
4026
41-
.. tip::
27+
$ php composer.phar create-project symfony/framework-standard-edition path/ ~2.3
4228
43-
You may also want to create a .gitignore file that can be used system-wide,
44-
in which case, you can find more information here: `Github .gitignore`_
45-
This way you can exclude files/folders often used by your IDE for all of your projects.
29+
Composer will now download the Standard Distribution along with all of the
30+
required vendor libraries. For more information about downloading Symfony using
31+
Composer, see `Installing Symfony using Composer`_.
4632

47-
4. Initialize your Git repository:
33+
#. Initialize your Git repository:
4834

4935
.. code-block:: bash
5036
5137
$ git init
5238
53-
5. Add all of the initial files to Git:
39+
#. Add all of the initial files to Git:
5440

5541
.. code-block:: bash
5642
5743
$ git add .
5844
59-
6. Create an initial commit with your started project:
45+
.. tip::
46+
47+
As you might have noticed, not all files that were downloaded by Composer in step 1,
48+
have been staged for commit by Git. Certain files and folders, such as the project's
49+
dependencies (which are managed by Composer), ``parameters.yml`` (which contains sensitive
50+
information such as database credentials), log and cache files and dumped assets (which are
51+
created automatically by your project), should not be committed in Git. To help you prevent
52+
committing those files and folders by accident, the Standard Distribution comes with a
53+
file called ``.gitignore``, which contains a list of files and folders that Git should
54+
ignore.
55+
56+
.. tip::
57+
58+
You may also want to create a ``.gitignore`` file that can be used system-wide.
59+
This allows you to exclude files/folders for all your projects that are created by
60+
your IDE or operating system. For details, see `Github .gitignore`_.
61+
62+
#. Create an initial commit with your started project:
6063

6164
.. code-block:: bash
6265
6366
$ git commit -m "Initial commit"
6467
65-
7. Finally, download all of the third-party vendor libraries by
66-
executing Composer. For details, see :ref:`installation-updating-vendors`.
67-
6868
At this point, you have a fully-functional Symfony2 project that's correctly
6969
committed to Git. You can immediately begin development, committing the new
7070
changes to your Git repository.
@@ -111,6 +111,7 @@ manage this is `Gitolite`_.
111111

112112
.. _`Git`: http://git-scm.com/
113113
.. _`Symfony2 Standard Edition`: http://symfony.com/download
114+
.. _`Installing Symfony using Composer`: http://symfony.com/doc/current/book/installation.html#option-1-composer
114115
.. _`git submodules`: http://git-scm.com/book/en/Git-Tools-Submodules
115116
.. _`GitHub`: https://github.com/
116117
.. _`barebones repository`: http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository

0 commit comments

Comments
 (0)
0