Skip to content

Commit ed8d805

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: (32 commits) Minor reword Update deployment.rst Update best_practices.rst Better explain the purpose of the "license" Composer metadata Reverted the changes about bundle namespaces Removed backticks from bundle names add mention of symfony.com re folder structure reword the documentation section re Resources/doc Reverting previous grammar change Removing trailing space Minor changes throughout BP for Reusable Bundles Mention the YAML features not supported by the Yaml component Update storage.rst Moved the commas in the opening paragraph. Adjust .platform.app.yaml from 'symfony' to 'composer' Don't pass .ico through app.php Update upload_file.rst Fixed class namespaces Reworded the prepare() method explanation Update dev_environment.rst ...
2 parents 72a7be9 + 41f415a commit ed8d805

16 files changed

+120
-60
lines changed

bundles/best_practices.rst

+24-23
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Bundle Name
3131
A bundle is also a PHP namespace. The namespace must follow the `PSR-0`_ or
3232
`PSR-4`_ interoperability standards for PHP namespaces and class names: it starts
3333
with a vendor segment, followed by zero or more category segments, and it ends
34-
with the namespace short name, which must end with a ``Bundle`` suffix.
34+
with the namespace short name, which must end with ``Bundle``.
3535

3636
A namespace becomes a bundle as soon as you add a bundle class to it. The
3737
bundle class name must follow these simple rules:
@@ -48,8 +48,8 @@ Here are some valid bundle namespaces and class names:
4848
========================== ==================
4949
Namespace Bundle Class Name
5050
========================== ==================
51-
``Acme\Bundle\BlogBundle`` ``AcmeBlogBundle``
52-
``Acme\BlogBundle`` ``AcmeBlogBundle``
51+
``Acme\Bundle\BlogBundle`` AcmeBlogBundle
52+
``Acme\BlogBundle`` AcmeBlogBundle
5353
========================== ==================
5454

5555
By convention, the ``getName()`` method of the bundle class should return the
@@ -58,8 +58,7 @@ class name.
5858
.. note::
5959

6060
If you share your bundle publicly, you must use the bundle class name as
61-
the name of the repository (``AcmeBlogBundle`` and not ``BlogBundle``
62-
for instance).
61+
the name of the repository (AcmeBlogBundle and not BlogBundle for instance).
6362

6463
.. note::
6564

@@ -68,7 +67,7 @@ class name.
6867
:class:`Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle`.
6968

7069
Each bundle has an alias, which is the lower-cased short version of the bundle
71-
name using underscores (``acme_blog`` for ``AcmeBlogBundle``). This alias
70+
name using underscores (``acme_blog`` for AcmeBlogBundle). This alias
7271
is used to enforce uniqueness within a project and for defining bundle's
7372
configuration options (see below for some usage examples).
7473

@@ -105,8 +104,8 @@ that automated tools can rely on:
105104
bundles are published under the MIT license, but you can `choose any license`_;
106105
* ``Resources/doc/index.rst``: The root file for the Bundle documentation.
107106

108-
The depth of sub-directories should be kept to the minimum for most used
109-
classes and files (two levels maximum).
107+
The depth of subdirectories should be kept to a minimum for the most used
108+
classes and files. Two levels is the maximum.
110109

111110
The bundle directory is read-only. If you need to write temporary files, store
112111
them under the ``cache/`` or ``log/`` directory of the host application. Tools
@@ -138,9 +137,9 @@ Classes
138137
-------
139138

140139
The bundle directory structure is used as the namespace hierarchy. For
141-
instance, a ``ContentController`` controller is stored in
142-
``Acme/BlogBundle/Controller/ContentController.php`` and the fully qualified
143-
class name is ``Acme\BlogBundle\Controller\ContentController``.
140+
instance, a ``ContentController`` controller which is stored in
141+
``Acme/BlogBundle/Controller/ContentController.php`` would have the fully
142+
qualified class name of ``Acme\BlogBundle\Controller\ContentController``.
144143

145144
All classes and files must follow the :doc:`Symfony coding standards </contributing/code/standards>`.
146145

@@ -158,8 +157,8 @@ Vendors
158157
A bundle must not embed third-party PHP libraries. It should rely on the
159158
standard Symfony autoloading instead.
160159

161-
A bundle should not embed third-party libraries written in JavaScript, CSS or
162-
any other language.
160+
A bundle should also not embed third-party libraries written in JavaScript,
161+
CSS or any other language.
163162

164163
Tests
165164
-----
@@ -183,10 +182,13 @@ Documentation
183182

184183
All classes and functions must come with full PHPDoc.
185184

186-
Extensive documentation should also be provided in the
187-
:doc:`reStructuredText </contributing/documentation/format>` format, under
188-
the ``Resources/doc/`` directory; the ``Resources/doc/index.rst`` file is
189-
the only mandatory file and must be the entry point for the documentation.
185+
Extensive documentation should also be provided in the ``Resources/doc/``
186+
directory.
187+
The index file (for example ``Resources/doc/index.rst`` or
188+
``Resources/doc/index.md``) is the only mandatory file and must be the entry
189+
point for the documentation. The
190+
:doc:`reStructuredText (rST) </contributing/documentation/format>` is the format
191+
used to render the documentation on symfony.com.
190192

191193
Installation Instructions
192194
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -232,7 +234,6 @@ following standardized instructions in your ``README.md`` file.
232234
{
233235
$bundles = array(
234236
// ...
235-
236237
new <vendor>\<bundle-name>\<bundle-long-name>(),
237238
);
238239
@@ -399,9 +400,9 @@ The ``composer.json`` file should include at least the following metadata:
399400
``name``
400401
Consists of the vendor and the short bundle name. If you are releasing the
401402
bundle on your own instead of on behalf of a company, use your personal name
402-
(e.g. ``johnsmith/blog-bundle``). The bundle short name excludes the vendor
403-
name and separates each word with an hyphen. For example: ``AcmeBlogBundle``
404-
is transformed into ``blog-bundle`` and ``AcmeSocialConnectBundle`` is
403+
(e.g. ``johnsmith/blog-bundle``). Exclude the vendor name from the bundle
404+
short name and separate each word with an hyphen. For example: AcmeBlogBundle
405+
is transformed into ``blog-bundle`` and AcmeSocialConnectBundle is
405406
transformed into ``social-connect-bundle``.
406407

407408
``description``
@@ -411,8 +412,7 @@ The ``composer.json`` file should include at least the following metadata:
411412
Use the ``symfony-bundle`` value.
412413

413414
``license``
414-
``MIT`` is the preferred license for Symfony bundles, but you can use any
415-
other license.
415+
a string (or array of strings) with a `valid license identifier`_, such as ``MIT``.
416416

417417
``autoload``
418418
This information is used by Symfony to load the classes of the bundle. The
@@ -497,3 +497,4 @@ Learn more
497497
.. _`Semantic Versioning Standard`: http://semver.org/
498498
.. _`Packagist`: https://packagist.org/
499499
.. _`choose any license`: http://choosealicense.com/
500+
.. _`valid license identifier`: https://spdx.org/licenses/

components/http_foundation.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,9 @@ UTF-8.
352352
Sending the Response
353353
~~~~~~~~~~~~~~~~~~~~
354354

355-
Before sending the Response, you can ensure that it is compliant with the HTTP
356-
specification by calling the
357-
:method:`Symfony\\Component\\HttpFoundation\\Response::prepare` method::
355+
Before sending the Response, you can optionally call the
356+
:method:`Symfony\\Component\\HttpFoundation\\Response::prepare` method to fix any
357+
incompatibility with the HTTP specification (e.g. a wrong ``Content-Type`` header)::
358358

359359
$response->prepare($request);
360360

components/yaml/yaml_format.rst

+24-13
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,11 @@
44
The YAML Format
55
===============
66

7-
According to the official `YAML`_ website, YAML is "a human friendly data
8-
serialization standard for all programming languages".
9-
10-
Even if the YAML format can describe complex nested data structure, this
11-
article only describes the minimum set of features needed to use YAML as a
12-
configuration file format.
13-
14-
YAML is a simple language that describes data. As PHP, it has a syntax for
15-
simple types like strings, booleans, floats, or integers. But unlike PHP, it
16-
makes a difference between arrays (sequences) and hashes (mappings).
7+
According to the official `YAML website`_, YAML is "a human friendly data
8+
serialization standard for all programming languages". The Symfony Yaml
9+
component implements a subset of the `YAML specification`_. Specifically, it
10+
implements the minimum set of features needed to use YAML as a configuration
11+
file format.
1712

1813
Scalars
1914
-------
@@ -171,8 +166,8 @@ Collections
171166
-----------
172167

173168
A YAML file is rarely used to describe a simple scalar. Most of the time, it
174-
describes a collection. A collection can be a sequence or a mapping of
175-
elements. Both sequences and mappings are converted to PHP arrays.
169+
describes a collection. YAML collections can be a sequence (indexed arrays in PHP)
170+
or a mapping of elements (associative arrays in PHP).
176171

177172
Sequences use a dash followed by a space:
178173

@@ -318,4 +313,20 @@ The YAML specification defines some tags to set the type of any data explicitly:
318313
Pz7Y6OjuDg4J+fn5OTk6enp
319314
56enmleECcgggoBADs=
320315
321-
.. _YAML: http://yaml.org/
316+
Unsupported YAML Features
317+
-------------------------
318+
319+
The following YAML features are not supported by the Symfony Yaml component:
320+
321+
* Multi-documents (``---`` and ``...`` markers);
322+
* Complex mapping keys and complex values starting with ``?``;
323+
* Tagged values as keys;
324+
* The following tags and types: `!!set`, `!!omap`, `!!pairs`, `!!set`, `!!seq`,
325+
`!!bool`, `!!int`, `!!merge`, `!!null`, `!!timestamp`, `!!value`, `!!yaml`;
326+
* Tags (``TAG`` directive; example: ``%TAG ! tag:example.com,2000:app/``)
327+
and tag references (example: ``!<tag:example.com,2000:app/foo>``);
328+
* Using sequence-like syntax for mapping elements (example: ``{foo, bar}``; use
329+
``{foo: ~, bar: ~}`` instead).
330+
331+
.. _`YAML website`: http://yaml.org/
332+
.. _`YAML specification`: http://www.yaml.org/spec/1.2/spec.html

controller/upload_file.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ Now, register this class as a Doctrine listener:
412412
413413
// ...
414414
$container->register('app.doctrine_brochure_listener', BrochureUploaderListener::class)
415-
->addArgument(new Reference('brochures_directory'))
415+
->addArgument(new Reference('app.brochure_uploader'))
416416
->addTag('doctrine.event_listener', array(
417417
'event' => 'prePersist',
418418
))

deployment.rst

+5-3
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@ Using Source Control
5252
~~~~~~~~~~~~~~~~~~~~
5353

5454
If you're using source control (e.g. Git or SVN), you can simplify by having
55-
your live installation also be a copy of your repository. When you're ready
56-
to upgrade it is as simple as fetching the latest updates from your source
57-
control system.
55+
your live installation also be a copy of your repository. When you're ready to
56+
upgrade it is as simple as fetching the latest updates from your source control
57+
system. When using Git, a common approach is to create a tag for each release
58+
and check out the appropriate tag on deployment (see `Git Tagging`_).
5859

5960
This makes updating your files *easier*, but you still need to worry about
6061
manually taking other steps (see `Common Post-Deployment Tasks`_).
@@ -206,6 +207,7 @@ Don't forget that deploying your application also involves updating any dependen
206207
(typically via Composer), migrating your database, clearing your cache and
207208
other potential things like pushing assets to a CDN (see `Common Post-Deployment Tasks`_).
208209

210+
.. _`Git Tagging`: https://git-scm.com/book/en/v2/Git-Basics-Tagging
209211
.. _`Capifony`: https://github.com/everzet/capifony
210212
.. _`Capistrano`: http://capistranorb.com/
211213
.. _`sf2debpkg`: https://github.com/liip/sf2debpkg

deployment/azure-website.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ application, configure it with the following content:
417417
<action type="CustomResponse" statusCode="403" statusReason="Forbidden: Access is denied." statusDescription="You do not have permission to view this directory or page using the credentials that you supplied." />
418418
</rule>
419419
<rule name="RewriteAssetsToPublic" stopProcessing="true">
420-
<match url="^(.*)(\.css|\.js|\.jpg|\.png|\.gif)$" />
420+
<match url="^(.*)(\.css|\.js|\.jpg|\.png|\.gif|\.ico)$" />
421421
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
422422
</conditions>
423423
<action type="Rewrite" url="web/{R:0}" />

deployment/fortrabbit.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ Make sure this file is imported into the main config file:
151151
<!-- .. -->
152152
<framework:config>
153153
<!-- .. -->
154-
<framework:session save-path="null" />
154+
<framework:session handler-id="null" />
155155
</framework:config>
156156
</container>
157157

deployment/platformsh.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Platform.sh how to deploy your application (read more about
4141
# The type of the application to build.
4242
type: php:5.6
4343
build:
44-
flavor: symfony
44+
flavor: composer
4545
4646
# The relationships of the application with services or other applications.
4747
# The left-hand side is the name of the relationship as it will be exposed

email/dev_environment.rst

+7-7
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ will not be sent when you run tests, but will continue to be sent in the
2828
2929
# app/config/config_test.yml
3030
swiftmailer:
31-
disable_delivery: true
31+
disable_delivery: true
3232
3333
.. code-block:: xml
3434
@@ -48,7 +48,7 @@ will not be sent when you run tests, but will continue to be sent in the
4848
4949
// app/config/config_test.php
5050
$container->loadFromExtension('swiftmailer', array(
51-
'disable_delivery' => "true",
51+
'disable_delivery' => "true",
5252
));
5353
5454
If you'd also like to disable deliver in the ``dev`` environment, simply
@@ -80,7 +80,8 @@ via the ``delivery_addresses`` option:
8080
xmlns:swiftmailer="http://symfony.com/schema/dic/swiftmailer"
8181
xsi:schemaLocation="http://symfony.com/schema/dic/services
8282
http://symfony.com/schema/dic/services/services-1.0.xsd
83-
http://symfony.com/schema/dic/swiftmailer http://symfony.com/schema/dic/swiftmailer/swiftmailer-1.0.xsd">
83+
http://symfony.com/schema/dic/swiftmailer
84+
http://symfony.com/schema/dic/swiftmailer/swiftmailer-1.0.xsd">
8485
8586
<swiftmailer:config>
8687
<swiftmailer:delivery-address>dev@example.com</swiftmailer:delivery-address>
@@ -155,15 +156,14 @@ by adding the ``delivery_whitelist`` option:
155156
.. code-block:: xml
156157
157158
<!-- app/config/config_dev.xml -->
158-
159-
<?xml version="1.0" charset="UTF-8" ?>
160159
<?xml version="1.0" encoding="UTF-8" ?>
161160
<container xmlns="http://symfony.com/schema/dic/services"
162161
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
163162
xmlns:swiftmailer="http://symfony.com/schema/dic/swiftmailer"
164163
xsi:schemaLocation="http://symfony.com/schema/dic/services
165164
http://symfony.com/schema/dic/services/services-1.0.xsd
166-
http://symfony.com/schema/dic/swiftmailer http://symfony.com/schema/dic/swiftmailer/swiftmailer-1.0.xsd">
165+
http://symfony.com/schema/dic/swiftmailer
166+
http://symfony.com/schema/dic/swiftmailer/swiftmailer-1.0.xsd">
167167
168168
<swiftmailer:config>
169169
<!-- all email addresses matching these regexes will be delivered
@@ -178,7 +178,7 @@ by adding the ``delivery_whitelist`` option:
178178
179179
// app/config/config_dev.php
180180
$container->loadFromExtension('swiftmailer', array(
181-
'delivery_addresses' => array("dev@example.com"),
181+
'delivery_addresses' => array("dev@example.com"),
182182
'delivery_whitelist' => array(
183183
// all email addresses matching these regexes will be delivered
184184
// like normal, as well as being sent to dev@example.com

form/action_method.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ form, you can use ``setAction()`` and ``setMethod()``:
5656
$formFactory = $formFactoryBuilder->getFormFactory();
5757
5858
$form = $formFactory->createBuilder(FormType::class, $task)
59-
->setAction($this->generateUrl('target_route'))
59+
->setAction('...')
6060
->setMethod('GET')
6161
->add('task', TextType::class)
6262
->add('dueDate', DateType::class)
@@ -108,7 +108,7 @@ options:
108108
$formFactory = $formFactoryBuilder->getFormFactory();
109109
110110
$form = $formFactory->create(TaskType::class, $task, array(
111-
'action' => $this->generateUrl('target_route'),
111+
'action' => '...',
112112
'method' => 'GET',
113113
));
114114

form/multiple_buttons.rst

+7
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,10 @@ querying if the "Save and add" button was clicked::
3131

3232
return $this->redirectToRoute($nextAction);
3333
}
34+
35+
Or you can get the button's name by using the
36+
:method:`Symfony\\Component\\Form\\Form::getClickedButton` method of the form::
37+
38+
if ($form->getClickedButton() && 'saveAndAdd' === $form->getClickedButton()->getName()) {
39+
// ...
40+
}

logging/monolog_email.rst

+38
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,44 @@ then passes them onto the nested handler in one go, but only if the records are
143143
unique over a given period of time (60 seconds by default). If the records are
144144
duplicates they are simply discarded. Adding this handler reduces the amount of
145145
notifications to a manageable level, specially in critical failure scenarios.
146+
You can adjust the time period using the ``time`` option:
147+
148+
.. configuration-block::
149+
150+
.. code-block:: yaml
151+
152+
# app/config/config_prod.yml
153+
monolog:
154+
handlers:
155+
# ...
156+
deduplicated:
157+
type: deduplication
158+
# the time in seconds during which duplicate entries are discarded (default: 60)
159+
time: 10
160+
handler: swift
161+
162+
.. code-block:: xml
163+
164+
<!-- app/config/config_prod.xml -->
165+
166+
<!-- time: the time in seconds during which duplicate entries are discarded (default: 60) -->
167+
<monolog:handler name="deduplicated"
168+
type="deduplication"
169+
time="10"
170+
handler="swift" />
171+
172+
.. code-block:: php
173+
174+
// app/config/config_prod.php
175+
$container->loadFromExtension('monolog', array(
176+
'handlers' => array(
177+
// ...
178+
'deduplicated' => array(
179+
'type' => 'deduplication',
180+
// the time in seconds during which duplicate entries are discarded (default: 60)
181+
'time' => 10,
182+
'handler' => 'swift',
183+
)
146184
147185
The messages are then passed to the ``swift`` handler. This is the handler that
148186
actually deals with emailing you the error. The settings for this are

profiler/storage.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ uses MySQL as the storage for the profiler with a lifetime of one hour:
5050
// ...
5151
$container->loadFromExtension('framework', array(
5252
'profiler' => array(
53-
'dsn' => 'mysql:host=localhost;dbname=%database_name%',
53+
'dsn' => 'mysql:host=localhost;dbname=%database_name%',
5454
'username' => '%database_user',
5555
'password' => '%database_password%',
5656
'lifetime' => 3600,

0 commit comments

Comments
 (0)