Skip to content

Commit bb08698

Browse files
committed
Merge branch '2.7' into 2.8
2 parents 326ae53 + cf61d87 commit bb08698

File tree

217 files changed

+537
-2819
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

217 files changed

+537
-2819
lines changed

best_practices/business-logic.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Inside here, you can create whatever directories you want to organize things:
2121
│ └─ AppBundle/
2222
│ └─ Utils/
2323
│ └─ MyClass.php
24+
├─ tests/
25+
├─ var/
2426
├─ vendor/
2527
└─ web/
2628
@@ -40,6 +42,8 @@ and put things there:
4042
│ │ └─ Utils/
4143
│ │ └─ MyClass.php
4244
│ └─ AppBundle/
45+
├─ tests/
46+
├─ var/
4347
├─ vendor/
4448
└─ web/
4549
@@ -318,7 +322,7 @@ command:
318322

319323
.. code-block:: bash
320324
321-
$ php app/console doctrine:fixtures:load
325+
$ php bin/console doctrine:fixtures:load
322326
323327
Careful, database will be purged. Do you want to continue Y/N ? Y
324328
> purging database

best_practices/configuration.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ Canonical Parameters
5252
Define all your application's parameters in the
5353
``app/config/parameters.yml.dist`` file.
5454

55-
Since version 2.3, Symfony includes a configuration file called ``parameters.yml.dist``,
56-
which stores the canonical list of configuration parameters for the application.
55+
Symfony includes a configuration file called ``parameters.yml.dist``, which
56+
stores the canonical list of configuration parameters for the application.
5757

5858
Whenever a new configuration parameter is defined for the application, you
5959
should also add it to this file and submit the changes to your version control

best_practices/creating-the-project.rst

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ to create files and execute the following commands:
2727

2828
.. code-block:: bash
2929
30-
# Linux, Mac OS X
3130
$ cd projects/
3231
$ symfony new blog
3332
@@ -63,27 +62,35 @@ number of files and directories generated automatically:
6362
6463
blog/
6564
├─ app/
66-
│ ├─ console
67-
│ ├─ cache/
6865
│ ├─ config/
69-
│ ├─ logs/
7066
│ └─ Resources/
67+
├─ bin
68+
│ └─ console
7169
├─ src/
7270
│ └─ AppBundle/
71+
├─ var/
72+
│ ├─ cache/
73+
│ ├─ logs/
74+
│ └─ sessions/
75+
├─ tests/
76+
│ └─ AppBundle/
7377
├─ vendor/
7478
└─ web/
7579
7680
This file and directory hierarchy is the convention proposed by Symfony to
7781
structure your applications. The recommended purpose of each directory is the
7882
following:
7983

80-
* ``app/cache/``, stores all the cache files generated by the application;
8184
* ``app/config/``, stores all the configuration defined for any environment;
82-
* ``app/logs/``, stores all the log files generated by the application;
8385
* ``app/Resources/``, stores all the templates and the translation files for the
8486
application;
8587
* ``src/AppBundle/``, stores the Symfony specific code (controllers and routes),
8688
your domain code (e.g. Doctrine classes) and all your business logic;
89+
* ``var/cache/``, stores all the cache files generated by the application;
90+
* ``var/logs/``, stores all the log files generated by the application;
91+
* ``var/sessions/``, stores all the session files generated by the application;
92+
* ``tests/AppBundle/``, stores the automatic tests (e.g. Unit tests) of the
93+
application.
8794
* ``vendor/``, this is the directory where Composer installs the application's
8895
dependencies and you should never modify any of its contents;
8996
* ``web/``, stores all the front controller files and all the web assets, such
@@ -107,8 +114,7 @@ ProductBundle, then there's no advantage to having two separate bundles.
107114
Create only one bundle called AppBundle for your application logic.
108115

109116
Implementing a single AppBundle bundle in your projects will make your code
110-
more concise and easier to understand. Starting in Symfony 2.6, the official
111-
Symfony documentation uses the AppBundle name.
117+
more concise and easier to understand.
112118

113119
.. note::
114120

@@ -128,13 +134,18 @@ that follows these best practices:
128134
129135
blog/
130136
├─ app/
131-
│ ├─ console
132-
│ ├─ cache/
133137
│ ├─ config/
134-
│ ├─ logs/
135138
│ └─ Resources/
139+
├─ bin/
140+
│ └─ console
136141
├─ src/
137142
│ └─ AppBundle/
143+
├─ tests/
144+
│ └─ AppBundle/
145+
├─ var/
146+
│ ├─ cache/
147+
│ ├─ logs/
148+
└─ sessions/
138149
├─ vendor/
139150
└─ web/
140151
├─ app.php
@@ -147,7 +158,7 @@ that follows these best practices:
147158

148159
.. code-block:: bash
149160
150-
$ php app/console generate:bundle --namespace=AppBundle --dir=src --format=annotation --no-interaction
161+
$ php bin/console generate:bundle --namespace=AppBundle --dir=src --format=annotation --no-interaction
151162
152163
Extending the Directory Structure
153164
---------------------------------
@@ -157,27 +168,6 @@ structure of Symfony, you can
157168
:doc:`override the location of the main directories </cookbook/configuration/override_dir_structure>`:
158169
``cache/``, ``logs/`` and ``web/``.
159170

160-
In addition, Symfony3 will use a slightly different directory structure when
161-
it's released:
162-
163-
.. code-block:: text
164-
165-
blog-symfony3/
166-
├─ app/
167-
│ ├─ config/
168-
│ └─ Resources/
169-
├─ bin/
170-
│ └─ console
171-
├─ src/
172-
├─ var/
173-
│ ├─ cache/
174-
│ └─ logs/
175-
├─ vendor/
176-
└─ web/
177-
178-
The changes are pretty superficial, but for now, we recommend that you use
179-
the Symfony directory structure.
180-
181171
.. _`Composer`: https://getcomposer.org/
182172
.. _`Phar extension`: http://php.net/manual/en/intro.phar.php
183173
.. _`public checksums repository`: https://github.com/sensiolabs/checksums

best_practices/forms.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,10 @@ makes them easier to re-use later.
8585

8686
Add buttons in the templates, not in the form classes or the controllers.
8787

88-
Since Symfony 2.3, you can add buttons as fields on your form. This is a nice
89-
way to simplify the template that renders your form. But if you add the buttons
90-
directly in your form class, this would effectively limit the scope of that form:
88+
The Symfony Form component allows you to add buttons as fields on your form.
89+
This is a nice way to simplify the template that renders your form. But if you
90+
add the buttons directly in your form class, this would effectively limit the
91+
scope of that form:
9192

9293
.. code-block:: php
9394

best_practices/i18n.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ Of all the available translation formats, only XLIFF and gettext have broad
3232
support in the tools used by professional translators. And since it's based
3333
on XML, you can validate XLIFF file contents as you write them.
3434

35-
Symfony 2.6 added support for notes inside XLIFF files, making them more
36-
user-friendly for translators. At the end, good translations are all about
37-
context, and these XLIFF notes allow you to define that context.
35+
Symfony supports notes in XLIFF files, making them more user-friendly for
36+
translators. At the end, good translations are all about context, and these
37+
XLIFF notes allow you to define that context.
3838

3939
.. tip::
4040

best_practices/introduction.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,8 @@ installer and then execute this command to download the demo application:
7676

7777
.. code-block:: bash
7878
79-
# Linux and Mac OS X
8079
$ symfony demo
8180
82-
# Windows
83-
c:\> php symfony demo
84-
8581
**The demo application is a simple blog engine**, because that will allow us to
8682
focus on the Symfony concepts and features without getting buried in difficult
8783
implementation details. Instead of developing the application step by step in

best_practices/security.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,6 @@ the same ``getAuthorEmail`` logic you used above:
270270
use Symfony\Component\Security\Core\User\UserInterface;
271271
use AppBundle\Entity\Post;
272272
273-
// Voter class requires Symfony 2.8 or higher version
274273
class PostVoter extends Voter
275274
{
276275
const CREATE = 'create';

best_practices/tests.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ functional tests, you can quickly spot any big errors before you deploy them:
2828

2929
A functional test can be as easy as this::
3030

31-
// src/AppBundle/Tests/ApplicationAvailabilityFunctionalTest.php
32-
namespace AppBundle\Tests;
31+
// tests/AppBundle/ApplicationAvailabilityFunctionalTest.php
32+
namespace Tests\AppBundle;
3333

3434
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
3535

book/bundles.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ Now that you've created the bundle, enable it via the ``AppKernel`` class::
107107
{
108108
$bundles = array(
109109
// ...
110+
110111
// register your bundle
111112
new Acme\TestBundle\AcmeTestBundle(),
112113
);
@@ -122,7 +123,7 @@ generating a basic bundle skeleton:
122123

123124
.. code-block:: bash
124125
125-
$ php app/console generate:bundle --namespace=Acme/TestBundle
126+
$ php bin/console generate:bundle --namespace=Acme/TestBundle
126127
127128
The bundle skeleton generates a basic controller, template and routing
128129
resource that can be customized. You'll learn more about Symfony's command-line

book/configuration.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,13 @@ FrameworkBundle configuration:
122122

123123
.. code-block:: bash
124124
125-
$ php app/console config:dump-reference FrameworkBundle
125+
$ php bin/console config:dump-reference FrameworkBundle
126126
127127
The extension alias (configuration key) can also be used:
128128

129129
.. code-block:: bash
130130
131-
$ php app/console config:dump-reference framework
131+
$ php bin/console config:dump-reference framework
132132
133133
.. note::
134134

@@ -177,7 +177,7 @@ cached files and allow them to rebuild:
177177

178178
.. code-block:: bash
179179
180-
$ php app/console cache:clear --env=prod --no-debug
180+
$ php bin/console cache:clear --env=prod --no-debug
181181
182182
.. note::
183183

book/controller.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ console command:
533533

534534
.. code-block:: bash
535535
536-
$ php app/console debug:container
536+
$ php bin/console debug:container
537537
538538
For more information, see the :doc:`/book/service_container` chapter.
539539

0 commit comments

Comments
 (0)