@@ -40,7 +40,7 @@ Use the Default Directory Structure
40
40
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
41
41
42
42
Unless your project follows a development practice that imposes a certain
43
- directory structure, follow the default Symfony directory structure. It's flat,
43
+ directory structure, follow the default Symfony directory structure. It is flat,
44
44
self-explanatory and not coupled to Symfony:
45
45
46
46
.. code-block :: text
@@ -123,7 +123,7 @@ Then, use just one or two words to describe the purpose of the parameter:
123
123
app.dir : ' ...'
124
124
# do this: short but easy to understand names
125
125
app.contents_dir : ' ...'
126
- # it's OK to use dots, underscores, dashes or nothing, but always
126
+ # it is OK to use dots, underscores, dashes or nothing, but always
127
127
# be consistent and use the same format for all the parameters
128
128
app.dir.contents : ' ...'
129
129
app.contents-dir : ' ...'
@@ -150,7 +150,7 @@ Twig templates and Doctrine entities, whereas parameters are only available
150
150
from places with access to the :doc: `service container </service_container >`.
151
151
152
152
The only notable disadvantage of using constants for this kind of configuration
153
- values is that it's complicated to redefine their values in your tests.
153
+ values is that it is complicated to redefine their values in your tests.
154
154
155
155
Business Logic
156
156
--------------
@@ -191,9 +191,9 @@ Use the YAML Format to Configure your own Services
191
191
192
192
If you use the :ref: `default services.yaml configuration <service-container-services-load-example >`,
193
193
most services will be configured automatically. However, in some edge cases
194
- you'll need to configure services (or parts of them) manually.
194
+ you will need to configure services (or parts of them) manually.
195
195
196
- YAML is the format recommended configuring services because it's friendly to
196
+ YAML is the format recommended configuring services because it is friendly to
197
197
newcomers and concise, but Symfony also supports XML and PHP configuration.
198
198
199
199
Use Attributes to Define the Doctrine Entity Mapping
@@ -203,7 +203,7 @@ Doctrine entities are plain PHP objects that you store in some "database".
203
203
Doctrine only knows about your entities through the mapping metadata configured
204
204
for your model classes.
205
205
206
- Doctrine supports several metadata formats, but it's recommended to use PHP
206
+ Doctrine supports several metadata formats, but it is recommended to use PHP
207
207
attributes because they are by far the most convenient and agile way of setting
208
208
up and looking for mapping information.
209
209
@@ -222,7 +222,7 @@ or checking security permissions.
222
222
223
223
Extending your controllers from this base controller couples your application
224
224
to Symfony. Coupling is generally wrong, but it may be OK in this case because
225
- controllers shouldn't contain any business logic. Controllers should contain
225
+ controllers should not contain any business logic. Controllers should contain
226
226
nothing more than a few lines of *glue-code *, so you are not coupling the
227
227
important parts of your application.
228
228
@@ -257,12 +257,12 @@ constructor arguments.
257
257
Use ParamConverters If They Are Convenient
258
258
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
259
259
260
- If you're using :doc: `Doctrine </doctrine >`, then you can *optionally * use the
260
+ If you are using :doc: `Doctrine </doctrine >`, then you can *optionally * use the
261
261
`ParamConverter `_ to automatically query for an entity and pass it as an argument
262
262
to your controller. It will also show a 404 page if no entity can be found.
263
263
264
264
If the logic to get an entity from a route variable is more complex, instead of
265
- configuring the ParamConverter, it's better to make the Doctrine query inside
265
+ configuring the ParamConverter, it is better to make the Doctrine query inside
266
266
the controller (e.g. by calling to a :doc: `Doctrine repository method </doctrine >`).
267
267
268
268
Templates
@@ -298,16 +298,16 @@ Add Form Buttons in Templates
298
298
299
299
Form classes should be agnostic to where they will be used. For example, the
300
300
button of a form used to both create and edit items should change from "Add new"
301
- to "Save changes" depending on where it's used.
301
+ to "Save changes" depending on where it is used.
302
302
303
- Instead of adding buttons in form classes or the controllers, it's recommended
303
+ Instead of adding buttons in form classes or the controllers, it is recommended
304
304
to add buttons in the templates. This also improves the separation of concerns
305
305
because the button styling (CSS class and other attributes) is defined in the
306
306
template instead of in a PHP class.
307
307
308
308
However, if you create a :doc: `form with multiple submit buttons </form/multiple_buttons >`
309
309
you should define them in the controller instead of the template. Otherwise, you
310
- won't be able to check which button was clicked when handling the form in the controller.
310
+ will not be able to check which button was clicked when handling the form in the controller.
311
311
312
312
Define Validation Constraints on the Underlying Object
313
313
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -323,7 +323,7 @@ Use a Single Action to Render and Process the Form
323
323
324
324
:ref: `Rendering forms <rendering-forms >` and :ref: `processing forms <processing-forms >`
325
325
are two of the main tasks when handling forms. Both are too similar (most of the
326
- time, almost identical), so it's much simpler to let a single controller action
326
+ time, almost identical), so it is much simpler to let a single controller action
327
327
handle both.
328
328
329
329
.. _best-practice-internationalization :
@@ -336,7 +336,7 @@ Use the XLIFF Format for Your Translation Files
336
336
337
337
Of all the translation formats supported by Symfony (PHP, Qt, ``.po ``, ``.mo ``,
338
338
JSON, CSV, INI, etc.), ``XLIFF `` and ``gettext `` have the best support in the tools used
339
- by professional translators. And since it's based on XML, you can validate ``XLIFF ``
339
+ by professional translators. And since it is based on XML, you can validate ``XLIFF ``
340
340
file contents as you write them.
341
341
342
342
Symfony also supports notes in XLIFF files, making them more user-friendly for
@@ -361,7 +361,7 @@ Define a Single Firewall
361
361
~~~~~~~~~~~~~~~~~~~~~~~~
362
362
363
363
Unless you have two legitimately different authentication systems and users
364
- (e.g. form login for the main site and a token system for your API only), it's
364
+ (e.g. form login for the main site and a token system for your API only), it is
365
365
recommended to have only one firewall to keep things simple.
366
366
367
367
Additionally, you should use the ``anonymous `` key under your firewall. If you
@@ -439,21 +439,21 @@ checks that all application URLs load successfully::
439
439
}
440
440
441
441
Add this test while creating your application because it requires little effort
442
- and checks that none of your pages returns an error. Later, you'll add more
442
+ and checks that none of your pages returns an error. Later, you will add more
443
443
specific tests for each page.
444
444
445
445
.. _hardcode-urls-in-a-functional-test :
446
446
447
447
Hard-code URLs in a Functional Test
448
448
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
449
449
450
- In Symfony applications, it's recommended to :ref: `generate URLs <routing-generating-urls >`
450
+ In Symfony applications, it is recommended to :ref: `generate URLs <routing-generating-urls >`
451
451
using routes to automatically update all links when a URL changes. However, if a
452
- public URL changes, users won't be able to browse it unless you set up a
452
+ public URL changes, users will not be able to browse it unless you set up a
453
453
redirection to the new URL.
454
454
455
- That's why it's recommended to use raw URLs in tests instead of generating them
456
- from routes. Whenever a route changes, tests will fail, and you'll know that
455
+ That's why it is recommended to use raw URLs in tests instead of generating them
456
+ from routes. Whenever a route changes, tests will fail, and you will know that
457
457
you must set up a redirection.
458
458
459
459
.. _`Symfony Demo` : https://github.com/symfony/demo
0 commit comments