Skip to content

Commit e99502d

Browse files
committed
Merge branch '2.1' into 2.2
2 parents 436b7fb + c895d64 commit e99502d

10 files changed

+47
-18
lines changed

book/doctrine.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,8 @@ doesn't replace your existing methods).
401401
The ``doctrine:generate:entities`` command saves a backup of the original
402402
``Product.php`` named ``Product.php~``. In some cases, the presence of
403403
this file can cause a "Cannot redeclare class" error. It can be safely
404-
removed.
404+
removed. You can also use the ``--no-backup`` option to prevent generating
405+
these backup files.
405406

406407
Note that you don't *need* to use this command. Doctrine doesn't rely
407408
on code generation. Like with normal PHP classes, you just need to make

components/dom_crawler.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ The crawler supports multiple ways of adding the content::
163163
.. note::
164164

165165
When dealing with character sets other than ISO-8859-1, always add HTML
166-
content using the :method:`Symfony\\Component\\DomCrawler\\Crawler::addHTMLContent``
166+
content using the :method:`Symfony\\Component\\DomCrawler\\Crawler::addHTMLContent`
167167
method where you can specify the second parameter to be your target character
168168
set.
169169

cookbook/assetic/asset_management.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ You can see an example in the previous section.
143143
.. caution::
144144

145145
When using the ``cssrewrite`` filter, don't refer to your CSS files using
146-
the ``@AcmeFooBundle``. See the note in the above section for details.
146+
the ``@AcmeFooBundle`` syntax. See the note in the above section for details.
147147

148148
Combining Assets
149149
~~~~~~~~~~~~~~~~

cookbook/bundles/inheritance.rst

+3-6
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,9 @@ The same goes for routing files, validation configuration and other resources.
9797

9898
.. caution::
9999

100-
Translation files do not work in the same way as described above. All
101-
translation files are accumulated into a set of "pools" (one for each)
102-
domain. Symfony loads translation files from bundles first (in the order
103-
that the bundles are initialized) and then from your ``app/Resources``
104-
directory. If the same translation is specified in two resources, the
105-
translation from the resource that's loaded last will win.
100+
Translation files do not work in the same way as described above. Read
101+
:ref:`override-translations` if you want to learn how to override
102+
translations.
106103

107104
.. _`FOSUserBundle`: https://github.com/friendsofsymfony/fosuserbundle
108105

cookbook/bundles/override.rst

+24-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Templates
1111
---------
1212

1313
For information on overriding templates, see
14+
1415
* :ref:`overriding-bundle-templates`.
1516
* :doc:`/cookbook/bundles/inheritance`
1617

@@ -31,6 +32,7 @@ Controllers
3132
Assuming the third-party bundle involved uses non-service controllers (which
3233
is almost always the case), you can easily override controllers via bundle
3334
inheritance. For more information, see :doc:`/cookbook/bundles/inheritance`.
35+
If the controller is a service, see the next section on how to override it.
3436

3537
Services & Configuration
3638
------------------------
@@ -69,7 +71,7 @@ Secondly, if the class is not available as a parameter, you want to make sure th
6971
class is always overridden when your bundle is used, or you need to modify
7072
something beyond just the class name, you should use a compiler pass::
7173

72-
// src/Acme/FooBundle/DependencyInjection/Compiler/OverrideServiceCompilerPass.php
74+
// src/Acme/DemoBundle/DependencyInjection/Compiler/OverrideServiceCompilerPass.php
7375
namespace Acme\DemoBundle\DependencyInjection\Compiler;
7476

7577
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
@@ -94,7 +96,11 @@ like adding a method call - you can only use the compiler pass method.
9496
Entities & Entity mapping
9597
-------------------------
9698

97-
In progress...
99+
Due to the way Doctrine works, it is not possible to override entity mapping
100+
of a bundle. However, if a bundle provides a mapped superclass (such as the
101+
``User`` entity in the FOSUserBundle) one can override attributes and
102+
associations. Learn more about this feature and its limitations in
103+
`the Doctrine documentation`_.
98104

99105
Forms
100106
-----
@@ -116,7 +122,22 @@ Validation metadata
116122

117123
In progress...
118124

125+
.. _override-translations:
126+
119127
Translations
120128
------------
121129

122-
In progress...
130+
Translations are not related to bundles, but to domains. That means that you
131+
can override the translations from any translation file, as long as it is in
132+
:ref:`the correct domain <translation-domains>`.
133+
134+
.. caution::
135+
136+
The last translation file always wins. That mean that you need to make
137+
sure that the bundle containing *your* translations is loaded after any
138+
bundle whose translations you're overriding. This is done in ``AppKernel``.
139+
140+
The file that always wins is the one that is placed in
141+
``app/Resources/translations``, as those files are always loaded last.
142+
143+
.. _`the Doctrine documentation`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/inheritance-mapping.html#overrides

cookbook/form/create_form_type_extension.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ it in the view::
239239
}
240240

241241
// set an "image_url" variable that will be available when rendering this field
242-
$view->set('image_url', $imageUrl);
242+
$view->vars['image_url'] = $imageUrl;
243243
}
244244
}
245245

cookbook/form/data_transformers.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ it's quite easy::
342342
{
343343
$builder
344344
->add('task')
345-
->add('dueDate', null, array('widget' => 'single_text'));
345+
->add('dueDate', null, array('widget' => 'single_text'))
346346
->add('issue', 'issue_selector');
347347
}
348348

cookbook/security/custom_authentication_provider.rst

+11-1
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,9 @@ set an authenticated token in the security context if successful.
137137
138138
try {
139139
$authToken = $this->authenticationManager->authenticate($token);
140-
141140
$this->securityContext->setToken($authToken);
141+
142+
return;
142143
} catch (AuthenticationException $failed) {
143144
// ... you might log something here
144145
@@ -152,6 +153,11 @@ set an authenticated token in the security context if successful.
152153
$event->setResponse($response);
153154
154155
}
156+
157+
// By default deny authorization
158+
$response = new Response();
159+
$response->setStatusCode(403);
160+
$event->setResponse($response);
155161
}
156162
}
157163
@@ -233,6 +239,10 @@ the ``PasswordDigest`` header value matches with the user's password.
233239
if (file_exists($this->cacheDir.'/'.$nonce) && file_get_contents($this->cacheDir.'/'.$nonce) + 300 > time()) {
234240
throw new NonceExpiredException('Previously used nonce detected');
235241
}
242+
// If cache directory does not exist we create it
243+
if (!is_dir($this->cacheDir)) {
244+
mkdir($this->cacheDir, 0777, true);
245+
}
236246
file_put_contents($this->cacheDir.'/'.$nonce, time());
237247
238248
// Validate Secret

cookbook/validation/custom_constraint.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ not to the property:
236236
# src/Acme/BlogBundle/Resources/config/validation.yml
237237
Acme\DemoBundle\Entity\AcmeEntity:
238238
constraints:
239-
Acme\DemoBundle\Validator\Constraints\ContainsAlphanumeric: ~
239+
- Acme\DemoBundle\Validator\Constraints\ContainsAlphanumeric: ~
240240
241241
.. code-block:: php-annotations
242242

reference/dic_tags.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -242,15 +242,15 @@ For details on creating your own custom data collection, read the cookbook
242242
article: :doc:`/cookbook/profiler/data_collector`.
243243
244244
doctrine.event_listener
245-
--------------
245+
-----------------------
246246
247247
**Purpose**: Add a Doctrine event listener
248248
249249
For details on creating Doctrine event listeners, read the cookbook article:
250250
:doc:`/cookbook/doctrine/event_listeners_subscribers`.
251251
252252
doctrine.event_subscriber
253-
--------------
253+
-------------------------
254254
255255
**Purpose**: Add a Doctrine event subscriber
256256

0 commit comments

Comments
 (0)