|
0
|
1 |
How to update your project? |
|
|
2 |
=========================== |
|
|
3 |
|
|
|
4 |
This document explains how to upgrade from one Symfony2 version to the next |
|
|
5 |
one. It only discusses changes that need to be done when using the "public" |
|
|
6 |
API of the framework. If you "hack" the core, you should probably follow the |
|
|
7 |
timeline closely anyway. |
|
|
8 |
|
|
|
9 |
RC4 to RC5 |
|
|
10 |
---------- |
|
|
11 |
|
|
|
12 |
* The `MapFileClassLoader` has been removed in favor of a new |
|
|
13 |
`MapClassLoader`. |
|
|
14 |
|
|
|
15 |
* The `exception_controller` setting has been moved from the `framework` |
|
|
16 |
section to the `twig` one. |
|
|
17 |
|
|
|
18 |
* The custom error pages must now reference `TwigBundle` instead of |
|
|
19 |
`FrameworkBundle` (see |
|
|
20 |
http://symfony.com/doc/2.0/cookbook/controller/error_pages.html) |
|
|
21 |
|
|
|
22 |
* `EntityUserProvider` class has been moved and FQCN changed from |
|
|
23 |
`Symfony\Component\Security\Core\User\EntityUserProvider` to |
|
|
24 |
`Symfony\Bridge\Doctrine\Security\User\EntityUserProvider`. |
|
|
25 |
|
|
|
26 |
* Cookies access from `HeaderBag` has been removed. Accessing Request cookies |
|
|
27 |
must be done via `Request::$cookies``. |
|
|
28 |
|
|
|
29 |
* `ResponseHeaderBag::getCookie()` and `ResponseHeaderBag::hasCookie()` |
|
|
30 |
methods were removed. |
|
|
31 |
|
|
|
32 |
* The method `ResponseHeaderBag::getCookies()` now supports an argument for the |
|
|
33 |
returned format (possible values are `ResponseHeaderBag::COOKIES_FLAT` |
|
|
34 |
(default value) or `ResponseHeaderBag::COOKIES_ARRAY`). |
|
|
35 |
|
|
|
36 |
* `ResponseHeaderBag::COOKIES_FLAT` returns a simple array (the array keys |
|
|
37 |
are not cookie names anymore): |
|
|
38 |
|
|
|
39 |
* array(0 => `a Cookie instance`, 1 => `another Cookie instance`) |
|
|
40 |
|
|
|
41 |
* `ResponseHeaderBag::COOKIES_ARRAY` returns a multi-dimensional array: |
|
|
42 |
|
|
|
43 |
* array(`the domain` => array(`the path` => array(`the cookie name` => `a Cookie instance`))) |
|
|
44 |
|
|
|
45 |
* Removed the guesser for the Choice constraint as the constraint only knows |
|
|
46 |
about the valid keys, and not their values. |
|
|
47 |
|
|
|
48 |
* The configuration of MonologBundle has been refactored. |
|
|
49 |
|
|
|
50 |
* Only services are supported for the processors. They are now registered |
|
|
51 |
using the `monolog.processor` tag which accept three optionnal attributes: |
|
|
52 |
|
|
|
53 |
* `handler`: the name of an handler to register it only for a specific handler |
|
|
54 |
* `channel`: to register it only for one logging channel (exclusive with `handler`) |
|
|
55 |
* `method`: The method used to process the record (`__invoke` is used if not set) |
|
|
56 |
|
|
|
57 |
* The email_prototype for the `SwiftMailerHandler` only accept a service id now. |
|
|
58 |
|
|
|
59 |
* Before: |
|
|
60 |
|
|
|
61 |
email_prototype: @acme_demo.monolog.email_prototype |
|
|
62 |
|
|
|
63 |
* After: |
|
|
64 |
|
|
|
65 |
email_prototype: acme_demo.monolog.email_prototype |
|
|
66 |
|
|
|
67 |
or if you want to use a factory for the prototype: |
|
|
68 |
|
|
|
69 |
email_prototype: |
|
|
70 |
id: acme_demo.monolog.email_prototype |
|
|
71 |
method: getPrototype |
|
|
72 |
|
|
|
73 |
* To avoid security issues, HTTP headers coming from proxies are not trusted |
|
|
74 |
anymore by default (like `HTTP_X_FORWARDED_FOR`, `X_FORWARDED_PROTO`, and |
|
|
75 |
`X_FORWARDED_HOST`). If your application is behind a reverse proxy, add the |
|
|
76 |
following configuration: |
|
|
77 |
|
|
|
78 |
framework: |
|
|
79 |
trust_proxy_headers: true |
|
|
80 |
|
|
|
81 |
* To avoid hidden naming collisions, the AbstractType does not try to define |
|
|
82 |
the name of form types magically. You now need to implement the `getName()` |
|
|
83 |
method explicitly when creating a custom type. |
|
|
84 |
|
|
|
85 |
* Renamed some methods to follow the naming conventions: |
|
|
86 |
|
|
|
87 |
Session::getAttributes() -> Session::all() |
|
|
88 |
Session::setAttributes() -> Session::replace() |
|
|
89 |
|
|
|
90 |
* {_locale} is not supported in paths in the access_control section anymore. You can |
|
|
91 |
rewrite the paths using a regular expression such as "(?:[a-z]{2})". |
|
|
92 |
|
|
|
93 |
RC3 to RC4 |
|
|
94 |
---------- |
|
|
95 |
|
|
|
96 |
* Annotation classes must be annotated with @Annotation |
|
|
97 |
(see the validator constraints for examples) |
|
|
98 |
|
|
|
99 |
* Annotations are not using the PHP autoloading but their own mechanism. This |
|
|
100 |
allows much more control about possible failure states. To make your code |
|
|
101 |
work, add the following lines at the end of your `autoload.php` file: |
|
|
102 |
|
|
|
103 |
use Doctrine\Common\Annotations\AnnotationRegistry; |
|
|
104 |
|
|
|
105 |
AnnotationRegistry::registerLoader(function($class) use ($loader) { |
|
|
106 |
$loader->loadClass($class); |
|
|
107 |
return class_exists($class, false); |
|
|
108 |
}); |
|
|
109 |
|
|
|
110 |
AnnotationRegistry::registerFile( |
|
|
111 |
__DIR__.'/../vendor/doctrine/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php' |
|
|
112 |
); |
|
|
113 |
|
|
|
114 |
The `$loader` variable is an instance of `UniversalClassLoader`. |
|
|
115 |
Additionally you might have to adjust the ORM path to the |
|
|
116 |
`DoctrineAnnotations.php`. If you are not using the `UniversalClassLoader` |
|
|
117 |
see the [Doctrine Annotations |
|
|
118 |
documentation](http://www.doctrine-project.org/docs/common/2.1/en/reference/annotations.html) |
|
|
119 |
for more details on how to register annotations. |
|
|
120 |
|
|
|
121 |
beta5 to RC1 |
|
|
122 |
------------ |
|
|
123 |
|
|
|
124 |
* Renamed `Symfony\Bundle\FrameworkBundle\Command\Command` to |
|
|
125 |
`Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand` |
|
|
126 |
|
|
|
127 |
* Removed the routing `AnnotGlobLoader` class |
|
|
128 |
|
|
|
129 |
* Some blocks in the Twig Form templates have been renamed to avoid |
|
|
130 |
collisions: |
|
|
131 |
|
|
|
132 |
* `container_attributes` to `widget_container_attributes` |
|
|
133 |
* `attributes` to `widget_attributes` |
|
|
134 |
* `options` to `widget_choice_options` |
|
|
135 |
|
|
|
136 |
* Event changes: |
|
|
137 |
|
|
|
138 |
* All listeners must now be tagged with `kernel.event_listener` instead of |
|
|
139 |
`kernel.listener`. |
|
|
140 |
* Kernel events are now properly prefixed with `kernel` instead of `core`: |
|
|
141 |
|
|
|
142 |
* Before: |
|
|
143 |
|
|
|
144 |
<tag name="kernel.listener" event="core.request" method="onCoreRequest" /> |
|
|
145 |
|
|
|
146 |
* After: |
|
|
147 |
|
|
|
148 |
<tag name="kernel.event_listener" event="kernel.request" method="onKernelRequest" /> |
|
|
149 |
|
|
|
150 |
Note: the method can of course remain as `onCoreRequest`, but renaming it |
|
|
151 |
as well for consistency with future projects makes sense. |
|
|
152 |
|
|
|
153 |
* The `Symfony\Component\HttpKernel\CoreEvents` class has been renamed to |
|
|
154 |
`Symfony\Component\HttpKernel\KernelEvents` |
|
|
155 |
|
|
|
156 |
* `TrueValidator` and `FalseValidator` constraints validators no longer accepts any value as valid data. |
|
|
157 |
|
|
|
158 |
beta4 to beta5 |
|
|
159 |
-------------- |
|
|
160 |
|
|
|
161 |
* `UserProviderInterface::loadUser()` has been renamed to |
|
|
162 |
`UserProviderInterface::refreshUser()` to make the goal of the method |
|
|
163 |
clearer. |
|
|
164 |
|
|
|
165 |
* The `$kernel` property on `WebTestCase` is now static. Change any instances |
|
|
166 |
of `$this->kernel` in your functional tests to `self::$kernel`. |
|
|
167 |
|
|
|
168 |
* The AsseticBundle has been moved to its own repository (it still bundled |
|
|
169 |
with Symfony SE). |
|
|
170 |
|
|
|
171 |
* Yaml Component: |
|
|
172 |
|
|
|
173 |
* Exception classes have been moved to their own namespace |
|
|
174 |
* `Yaml::load()` has been renamed to `Yaml::parse()` |
|
|
175 |
|
|
|
176 |
* The File classes from `HttpFoundation` have been refactored: |
|
|
177 |
|
|
|
178 |
* `Symfony\Component\HttpFoundation\File\File` has a new API: |
|
|
179 |
|
|
|
180 |
* It now extends `\SplFileInfo`: |
|
|
181 |
|
|
|
182 |
* former `getName()` equivalent is `getBasename()`, |
|
|
183 |
* former `getDirectory()` equivalent is `getPath()`, |
|
|
184 |
* former `getPath()` equivalent is `getRealPath()`. |
|
|
185 |
|
|
|
186 |
* the `move()` method now creates the target directory when it does not exist, |
|
|
187 |
|
|
|
188 |
* `getExtension()` and `guessExtension()` do not return the extension |
|
|
189 |
with a leading `.` anymore |
|
|
190 |
|
|
|
191 |
* `Symfony\Component\HttpFoundation\File\UploadedFile` has a new API: |
|
|
192 |
|
|
|
193 |
* The constructor has a new Boolean parameter that must be set to true |
|
|
194 |
in test mode only in order to be able to move the file. This parameter |
|
|
195 |
is not intended to be set to true from outside of the core files. |
|
|
196 |
|
|
|
197 |
* `getMimeType()` now always returns the mime type of the underlying file. |
|
|
198 |
Use `getClientMimeType()` to get the mime type from the request. |
|
|
199 |
|
|
|
200 |
* `getSize()` now always returns the size of the underlying file. |
|
|
201 |
Use `getClientSize()` to get the file size from the request. |
|
|
202 |
|
|
|
203 |
* Use `getClientOriginalName()` to retrieve the original name from the |
|
|
204 |
request. |
|
|
205 |
|
|
|
206 |
* The `extensions` setting for Twig has been removed. There is now only one |
|
|
207 |
way to register Twig extensions, via the `twig.extension` tag. |
|
|
208 |
|
|
|
209 |
* The stack of Monolog handlers now bubbles the records by default. To stop |
|
|
210 |
the propagation you need to configure the bubbling explicitly. |
|
|
211 |
|
|
|
212 |
* Expanded the `SerializerInterface`, while reducing the number of public |
|
|
213 |
methods in the Serializer class itself breaking BC and adding component |
|
|
214 |
specific Exception classes. |
|
|
215 |
|
|
|
216 |
* The `FileType` Form class has been heavily changed: |
|
|
217 |
|
|
|
218 |
* The temporary storage has been removed. |
|
|
219 |
|
|
|
220 |
* The file type `type` option has also been removed (the new behavior is |
|
|
221 |
the same as when the `type` was set to `file` before). |
|
|
222 |
|
|
|
223 |
* The file input is now rendered as any other input field. |
|
|
224 |
|
|
|
225 |
* The `em` option of the Doctrine `EntityType` class now takes the entity |
|
|
226 |
manager name instead of the EntityManager instance. If you don't pass this |
|
|
227 |
option, the default Entity Manager will be used as before. |
|
|
228 |
|
|
|
229 |
* In the Console component: `Command::getFullname()` and |
|
|
230 |
`Command::getNamespace()` have been removed (`Command::getName()` behavior |
|
|
231 |
is now the same as the old `Command::getFullname()`). |
|
|
232 |
|
|
|
233 |
* Default Twig form templates have been moved to the Twig bridge. Here is how |
|
|
234 |
you can reference them now from a template or in a configuration setting: |
|
|
235 |
|
|
|
236 |
Before: |
|
|
237 |
|
|
|
238 |
TwigBundle:Form:div_layout.html.twig |
|
|
239 |
|
|
|
240 |
After: |
|
|
241 |
|
|
|
242 |
form_div_layout.html.twig |
|
|
243 |
|
|
|
244 |
* All settings regarding the cache warmers have been removed. |
|
|
245 |
|
|
|
246 |
* `Response::isRedirected()` has been merged with `Response::isRedirect()` |
|
|
247 |
|
|
|
248 |
beta3 to beta4 |
|
|
249 |
-------------- |
|
|
250 |
|
|
|
251 |
* `Client::getProfiler` has been removed in favor of `Client::getProfile`, |
|
|
252 |
which returns an instance of `Profile`. |
|
|
253 |
|
|
|
254 |
* Some `UniversalClassLoader` methods have been renamed: |
|
|
255 |
|
|
|
256 |
* `registerPrefixFallback` to `registerPrefixFallbacks` |
|
|
257 |
* `registerNamespaceFallback` to `registerNamespaceFallbacks` |
|
|
258 |
|
|
|
259 |
* The event system has been made more flexible. A listener can now be any |
|
|
260 |
valid PHP callable. |
|
|
261 |
|
|
|
262 |
* `EventDispatcher::addListener($eventName, $listener, $priority = 0)`: |
|
|
263 |
* `$eventName` is the event name (cannot be an array anymore), |
|
|
264 |
* `$listener` is a PHP callable. |
|
|
265 |
|
|
|
266 |
* The events classes and constants have been renamed: |
|
|
267 |
|
|
|
268 |
* Old class name `Symfony\Component\Form\Events` and constants: |
|
|
269 |
|
|
|
270 |
Events::preBind = 'preBind' |
|
|
271 |
Events::postBind = 'postBind' |
|
|
272 |
Events::preSetData = 'preSetData' |
|
|
273 |
Events::postSetData = 'postSetData' |
|
|
274 |
Events::onBindClientData = 'onBindClientData' |
|
|
275 |
Events::onBindNormData = 'onBindNormData' |
|
|
276 |
Events::onSetData = 'onSetData' |
|
|
277 |
|
|
|
278 |
* New class name `Symfony\Component\Form\FormEvents` and constants: |
|
|
279 |
|
|
|
280 |
FormEvents::PRE_BIND = 'form.pre_bind' |
|
|
281 |
FormEvents::POST_BIND = 'form.post_bind' |
|
|
282 |
FormEvents::PRE_SET_DATA = 'form.pre_set_data' |
|
|
283 |
FormEvents::POST_SET_DATA = 'form.post_set_data' |
|
|
284 |
FormEvents::BIND_CLIENT_DATA = 'form.bind_client_data' |
|
|
285 |
FormEvents::BIND_NORM_DATA = 'form.bind_norm_data' |
|
|
286 |
FormEvents::SET_DATA = 'form.set_data' |
|
|
287 |
|
|
|
288 |
* Old class name `Symfony\Component\HttpKernel\Events` and constants: |
|
|
289 |
|
|
|
290 |
Events::onCoreRequest = 'onCoreRequest' |
|
|
291 |
Events::onCoreException = 'onCoreException' |
|
|
292 |
Events::onCoreView = 'onCoreView' |
|
|
293 |
Events::onCoreController = 'onCoreController' |
|
|
294 |
Events::onCoreResponse = 'onCoreResponse' |
|
|
295 |
|
|
|
296 |
* New class name `Symfony\Component\HttpKernel\CoreEvents` and constants: |
|
|
297 |
|
|
|
298 |
CoreEvents::REQUEST = 'core.request' |
|
|
299 |
CoreEvents::EXCEPTION = 'core.exception' |
|
|
300 |
CoreEvents::VIEW = 'core.view' |
|
|
301 |
CoreEvents::CONTROLLER = 'core.controller' |
|
|
302 |
CoreEvents::RESPONSE = 'core.response' |
|
|
303 |
|
|
|
304 |
* Old class name `Symfony\Component\Security\Http\Events` and constants: |
|
|
305 |
|
|
|
306 |
Events::onSecurityInteractiveLogin = 'onSecurityInteractiveLogin' |
|
|
307 |
Events::onSecuritySwitchUser = 'onSecuritySwitchUser' |
|
|
308 |
|
|
|
309 |
* New class name `Symfony\Component\Security\Http\SecurityEvents` and constants: |
|
|
310 |
|
|
|
311 |
SecurityEvents::INTERACTIVE_LOGIN = 'security.interactive_login' |
|
|
312 |
SecurityEvents::SWITCH_USER = 'security.switch_user' |
|
|
313 |
|
|
|
314 |
* `addListenerService` now only takes a single event name as its first |
|
|
315 |
argument, |
|
|
316 |
|
|
|
317 |
* Tags in configuration must now set the method to call: |
|
|
318 |
|
|
|
319 |
* Before: |
|
|
320 |
|
|
|
321 |
<tag name="kernel.listener" event="onCoreRequest" /> |
|
|
322 |
|
|
|
323 |
* After: |
|
|
324 |
|
|
|
325 |
<tag name="kernel.listener" event="core.request" method="onCoreRequest" /> |
|
|
326 |
|
|
|
327 |
* Subscribers must now always return a hash: |
|
|
328 |
|
|
|
329 |
* Before: |
|
|
330 |
|
|
|
331 |
public static function getSubscribedEvents() |
|
|
332 |
{ |
|
|
333 |
return Events::onBindNormData; |
|
|
334 |
} |
|
|
335 |
|
|
|
336 |
* After: |
|
|
337 |
|
|
|
338 |
public static function getSubscribedEvents() |
|
|
339 |
{ |
|
|
340 |
return array(FormEvents::BIND_NORM_DATA => 'onBindNormData'); |
|
|
341 |
} |
|
|
342 |
|
|
|
343 |
* Form `DateType` parameter `single-text` changed to `single_text` |
|
|
344 |
* Form field label helpers now accepts setting attributes, i.e.: |
|
|
345 |
|
|
|
346 |
```html+jinja |
|
|
347 |
{{ form_label(form.name, 'Custom label', { 'attr': {'class': 'name_field'} }) }} |
|
|
348 |
``` |
|
|
349 |
|
|
|
350 |
* In order to use Swiftmailer, you should now register its "init.php" file via |
|
|
351 |
the autoloader ("app/autoloader.php") and remove the `Swift_` prefix from |
|
|
352 |
the autoloader. For an example on how this should be done, see the Standard |
|
|
353 |
Distribution |
|
|
354 |
[autoload.php](https://github.com/symfony/symfony-standard/blob/v2.0.0BETA4/app/autoload.php#L29). |
|
|
355 |
|
|
|
356 |
beta2 to beta3 |
|
|
357 |
-------------- |
|
|
358 |
|
|
|
359 |
* The settings under `framework.annotations` have changed slightly: |
|
|
360 |
|
|
|
361 |
Before: |
|
|
362 |
|
|
|
363 |
framework: |
|
|
364 |
annotations: |
|
|
365 |
cache: file |
|
|
366 |
file_cache: |
|
|
367 |
debug: true |
|
|
368 |
dir: /foo |
|
|
369 |
|
|
|
370 |
After: |
|
|
371 |
|
|
|
372 |
framework: |
|
|
373 |
annotations: |
|
|
374 |
cache: file |
|
|
375 |
debug: true |
|
|
376 |
file_cache_dir: /foo |
|
|
377 |
|
|
|
378 |
beta1 to beta2 |
|
|
379 |
-------------- |
|
|
380 |
|
|
|
381 |
* The annotation parsing process has been changed (it now uses Doctrine Common |
|
|
382 |
3.0). All annotations which are used in a class must now be imported (just |
|
|
383 |
like you import PHP namespaces with the "use" statement): |
|
|
384 |
|
|
|
385 |
Before: |
|
|
386 |
|
|
|
387 |
``` php |
|
|
388 |
<?php |
|
|
389 |
|
|
|
390 |
/** |
|
|
391 |
* @orm:Entity |
|
|
392 |
*/ |
|
|
393 |
class AcmeUser |
|
|
394 |
{ |
|
|
395 |
/** |
|
|
396 |
* @orm:Id |
|
|
397 |
* @orm:GeneratedValue(strategy = "AUTO") |
|
|
398 |
* @orm:Column(type="integer") |
|
|
399 |
* @var integer |
|
|
400 |
*/ |
|
|
401 |
private $id; |
|
|
402 |
|
|
|
403 |
/** |
|
|
404 |
* @orm:Column(type="string", nullable=false) |
|
|
405 |
* @assert:NotBlank |
|
|
406 |
* @var string |
|
|
407 |
*/ |
|
|
408 |
private $name; |
|
|
409 |
} |
|
|
410 |
``` |
|
|
411 |
After: |
|
|
412 |
|
|
|
413 |
``` php |
|
|
414 |
<?php |
|
|
415 |
|
|
|
416 |
use Doctrine\ORM\Mapping as ORM; |
|
|
417 |
use Symfony\Component\Validator\Constraints as Assert; |
|
|
418 |
|
|
|
419 |
/** |
|
|
420 |
* @ORM\Entity |
|
|
421 |
*/ |
|
|
422 |
class AcmeUser |
|
|
423 |
{ |
|
|
424 |
/** |
|
|
425 |
* @ORM\Id |
|
|
426 |
* @ORM\GeneratedValue(strategy="AUTO") |
|
|
427 |
* @ORM\Column(type="integer") |
|
|
428 |
* |
|
|
429 |
* @var integer |
|
|
430 |
*/ |
|
|
431 |
private $id; |
|
|
432 |
|
|
|
433 |
/** |
|
|
434 |
* @ORM\Column(type="string", nullable=false) |
|
|
435 |
* @Assert\NotBlank |
|
|
436 |
* |
|
|
437 |
* @var string |
|
|
438 |
*/ |
|
|
439 |
private $name; |
|
|
440 |
} |
|
|
441 |
``` |
|
|
442 |
|
|
|
443 |
* The `Set` constraint has been removed as it is not required anymore. |
|
|
444 |
|
|
|
445 |
Before: |
|
|
446 |
|
|
|
447 |
``` php |
|
|
448 |
<?php |
|
|
449 |
|
|
|
450 |
/** |
|
|
451 |
* @orm:Entity |
|
|
452 |
*/ |
|
|
453 |
class AcmeEntity |
|
|
454 |
{ |
|
|
455 |
/** |
|
|
456 |
* @assert:Set({@assert:Callback(...), @assert:Callback(...)}) |
|
|
457 |
*/ |
|
|
458 |
private $foo; |
|
|
459 |
} |
|
|
460 |
``` |
|
|
461 |
After: |
|
|
462 |
|
|
|
463 |
``` php |
|
|
464 |
<?php |
|
|
465 |
|
|
|
466 |
use Doctrine\ORM\Mapping as ORM; |
|
|
467 |
use Symfony\Component\Validator\Constraints\Callback; |
|
|
468 |
|
|
|
469 |
/** |
|
|
470 |
* @ORM\Entity |
|
|
471 |
*/ |
|
|
472 |
class AcmeEntity |
|
|
473 |
{ |
|
|
474 |
/** |
|
|
475 |
* @Callback(...) |
|
|
476 |
* @Callback(...) |
|
|
477 |
*/ |
|
|
478 |
private $foo; |
|
|
479 |
} |
|
|
480 |
``` |
|
|
481 |
|
|
|
482 |
* The config under `framework.validation.annotations` has been removed and was |
|
|
483 |
replaced with a boolean flag `framework.validation.enable_annotations` which |
|
|
484 |
defaults to false. |
|
|
485 |
|
|
|
486 |
* Forms must now be explicitly enabled (automatically done in Symfony SE): |
|
|
487 |
|
|
|
488 |
framework: |
|
|
489 |
form: ~ |
|
|
490 |
|
|
|
491 |
Which is equivalent to: |
|
|
492 |
|
|
|
493 |
framework: |
|
|
494 |
form: |
|
|
495 |
enabled: true |
|
|
496 |
|
|
|
497 |
* The Routing Exceptions have been moved: |
|
|
498 |
|
|
|
499 |
Before: |
|
|
500 |
|
|
|
501 |
Symfony\Component\Routing\Matcher\Exception\Exception |
|
|
502 |
Symfony\Component\Routing\Matcher\Exception\NotFoundException |
|
|
503 |
Symfony\Component\Routing\Matcher\Exception\MethodNotAllowedException |
|
|
504 |
|
|
|
505 |
After: |
|
|
506 |
|
|
|
507 |
Symfony\Component\Routing\Exception\Exception |
|
|
508 |
Symfony\Component\Routing\Exception\NotFoundException |
|
|
509 |
Symfony\Component\Routing\Exception\MethodNotAllowedException |
|
|
510 |
|
|
|
511 |
* The form component's `csrf_page_id` option has been renamed to |
|
|
512 |
`intention`. |
|
|
513 |
|
|
|
514 |
* The `error_handler` setting has been removed. The `ErrorHandler` class |
|
|
515 |
is now managed directly by Symfony SE in `AppKernel`. |
|
|
516 |
|
|
|
517 |
* The Doctrine metadata files has moved from |
|
|
518 |
`Resources/config/doctrine/metadata/orm/` to `Resources/config/doctrine`, |
|
|
519 |
the extension from `.dcm.yml` to `.orm.yml`, and the file name has been |
|
|
520 |
changed to the short class name. |
|
|
521 |
|
|
|
522 |
Before: |
|
|
523 |
|
|
|
524 |
Resources/config/doctrine/metadata/orm/Bundle.Entity.dcm.xml |
|
|
525 |
Resources/config/doctrine/metadata/orm/Bundle.Entity.dcm.yml |
|
|
526 |
|
|
|
527 |
After: |
|
|
528 |
|
|
|
529 |
Resources/config/doctrine/Entity.orm.xml |
|
|
530 |
Resources/config/doctrine/Entity.orm.yml |
|
|
531 |
|
|
|
532 |
* With the introduction of a new Doctrine Registry class, the following |
|
|
533 |
parameters have been removed (replaced by methods on the `doctrine` |
|
|
534 |
service): |
|
|
535 |
|
|
|
536 |
* `doctrine.orm.entity_managers` |
|
|
537 |
* `doctrine.orm.default_entity_manager` |
|
|
538 |
* `doctrine.dbal.default_connection` |
|
|
539 |
|
|
|
540 |
Before: |
|
|
541 |
|
|
|
542 |
$container->getParameter('doctrine.orm.entity_managers') |
|
|
543 |
$container->getParameter('doctrine.orm.default_entity_manager') |
|
|
544 |
$container->getParameter('doctrine.orm.default_connection') |
|
|
545 |
|
|
|
546 |
After: |
|
|
547 |
|
|
|
548 |
$container->get('doctrine')->getEntityManagerNames() |
|
|
549 |
$container->get('doctrine')->getDefaultEntityManagerName() |
|
|
550 |
$container->get('doctrine')->getDefaultConnectionName() |
|
|
551 |
|
|
|
552 |
But you don't really need to use these methods anymore, as to get an entity |
|
|
553 |
manager, you can now use the registry directly: |
|
|
554 |
|
|
|
555 |
Before: |
|
|
556 |
|
|
|
557 |
$em = $this->get('doctrine.orm.entity_manager'); |
|
|
558 |
$em = $this->get('doctrine.orm.foobar_entity_manager'); |
|
|
559 |
|
|
|
560 |
After: |
|
|
561 |
|
|
|
562 |
$em = $this->get('doctrine')->getEntityManager(); |
|
|
563 |
$em = $this->get('doctrine')->getEntityManager('foobar'); |
|
|
564 |
|
|
|
565 |
* The `doctrine:generate:entities` arguments and options changed. Run |
|
|
566 |
`./app/console doctrine:generate:entities --help` for more information about |
|
|
567 |
the new syntax. |
|
|
568 |
|
|
|
569 |
* The `doctrine:generate:repositories` command has been removed. The |
|
|
570 |
functionality has been moved to the `doctrine:generate:entities`. |
|
|
571 |
|
|
|
572 |
* Doctrine event subscribers now use a unique "doctrine.event_subscriber" tag. |
|
|
573 |
Doctrine event listeners also use a unique "doctrine.event_listener" tag. To |
|
|
574 |
specify a connection, use the optional "connection" attribute. |
|
|
575 |
|
|
|
576 |
Before: |
|
|
577 |
|
|
|
578 |
listener: |
|
|
579 |
class: MyEventListener |
|
|
580 |
tags: |
|
|
581 |
- { name: doctrine.common.event_listener, event: name } |
|
|
582 |
- { name: doctrine.dbal.default_event_listener, event: name } |
|
|
583 |
subscriber: |
|
|
584 |
class: MyEventSubscriber |
|
|
585 |
tags: |
|
|
586 |
- { name: doctrine.common.event_subscriber } |
|
|
587 |
- { name: doctrine.dbal.default_event_subscriber } |
|
|
588 |
|
|
|
589 |
After: |
|
|
590 |
|
|
|
591 |
listener: |
|
|
592 |
class: MyEventListener |
|
|
593 |
tags: |
|
|
594 |
- { name: doctrine.event_listener, event: name } # register for all connections |
|
|
595 |
- { name: doctrine.event_listener, event: name, connection: default } # only for the default connection |
|
|
596 |
subscriber: |
|
|
597 |
class: MyEventSubscriber |
|
|
598 |
tags: |
|
|
599 |
- { name: doctrine.event_subscriber } # register for all connections |
|
|
600 |
- { name: doctrine.event_subscriber, connection: default } # only for the default connection |
|
|
601 |
|
|
|
602 |
* Application translations are now stored in the `Resources` directory: |
|
|
603 |
|
|
|
604 |
Before: |
|
|
605 |
|
|
|
606 |
app/translations/catalogue.fr.xml |
|
|
607 |
|
|
|
608 |
After: |
|
|
609 |
|
|
|
610 |
app/Resources/translations/catalogue.fr.xml |
|
|
611 |
|
|
|
612 |
* The option `modifiable` of the `collection` form type was split into two |
|
|
613 |
options `allow_add` and `allow_delete`. |
|
|
614 |
|
|
|
615 |
Before: |
|
|
616 |
|
|
|
617 |
$builder->add('tags', 'collection', array( |
|
|
618 |
'type' => 'text', |
|
|
619 |
'modifiable' => true, |
|
|
620 |
)); |
|
|
621 |
|
|
|
622 |
After: |
|
|
623 |
|
|
|
624 |
$builder->add('tags', 'collection', array( |
|
|
625 |
'type' => 'text', |
|
|
626 |
'allow_add' => true, |
|
|
627 |
'allow_delete' => true, |
|
|
628 |
)); |
|
|
629 |
|
|
|
630 |
* `Request::hasSession()` has been renamed to `Request::hasPreviousSession()`. The |
|
|
631 |
method `hasSession()` still exists, but only checks if the request contains a |
|
|
632 |
session object, not if the session was started in a previous request. |
|
|
633 |
|
|
|
634 |
* Serializer: The NormalizerInterface's `supports()` method has been split in |
|
|
635 |
two methods: `supportsNormalization()` and `supportsDenormalization()`. |
|
|
636 |
|
|
|
637 |
* `ParameterBag::getDeep()` has been removed, and is replaced with a boolean flag |
|
|
638 |
on the `ParameterBag::get()` method. |
|
|
639 |
|
|
|
640 |
* Serializer: `AbstractEncoder` & `AbstractNormalizer` were renamed to |
|
|
641 |
`SerializerAwareEncoder` & `SerializerAwareNormalizer`. |
|
|
642 |
|
|
|
643 |
* Serializer: The `$properties` argument has been dropped from all interfaces. |
|
|
644 |
|
|
|
645 |
* Form: Renamed option value `text` of `widget` option of the `date` type was |
|
|
646 |
renamed to `single-text`. `text` indicates to use separate text boxes now |
|
|
647 |
(like for the `time` type). |
|
|
648 |
|
|
|
649 |
* Form: Renamed view variable `name` to `full_name`. The variable `name` now |
|
|
650 |
contains the local, short name (equivalent to `$form->getName()`). |
|
|
651 |
|
|
|
652 |
PR12 to beta1 |
|
|
653 |
------------- |
|
|
654 |
|
|
|
655 |
* The CSRF secret configuration has been moved to a mandatory global `secret` |
|
|
656 |
setting (as the secret is now used for everything and not just CSRF): |
|
|
657 |
|
|
|
658 |
Before: |
|
|
659 |
|
|
|
660 |
framework: |
|
|
661 |
csrf_protection: |
|
|
662 |
secret: S3cr3t |
|
|
663 |
|
|
|
664 |
After: |
|
|
665 |
|
|
|
666 |
framework: |
|
|
667 |
secret: S3cr3t |
|
|
668 |
|
|
|
669 |
* The `File::getWebPath()` and `File::rename()` methods have been removed, as |
|
|
670 |
well as the `framework.document_root` configuration setting. |
|
|
671 |
|
|
|
672 |
* The `File::getDefaultExtension()` method has been renamed to `File::guessExtension()`. |
|
|
673 |
The renamed method now returns null if it cannot guess the extension. |
|
|
674 |
|
|
|
675 |
* The `session` configuration has been refactored: |
|
|
676 |
|
|
|
677 |
* The `class` option has been removed (use the `session.class` parameter |
|
|
678 |
instead); |
|
|
679 |
|
|
|
680 |
* The PDO session storage configuration has been removed (a cookbook recipe |
|
|
681 |
is in the work); |
|
|
682 |
|
|
|
683 |
* The `storage_id` option now takes a service id instead of just part of it. |
|
|
684 |
|
|
|
685 |
* The `DoctrineMigrationsBundle` and `DoctrineFixturesBundle` bundles have |
|
|
686 |
been moved to their own repositories. |
|
|
687 |
|
|
|
688 |
* The form framework has been refactored extensively (more information in the |
|
|
689 |
documentation). |
|
|
690 |
|
|
|
691 |
* The `trans` tag does not accept a message as an argument anymore: |
|
|
692 |
|
|
|
693 |
{% trans "foo" %} |
|
|
694 |
{% trans foo %} |
|
|
695 |
|
|
|
696 |
Use the long version the tags or the filter instead: |
|
|
697 |
|
|
|
698 |
{% trans %}foo{% endtrans %} |
|
|
699 |
{{ foo|trans }} |
|
|
700 |
|
|
|
701 |
This has been done to clarify the usage of the tag and filter and also to |
|
|
702 |
make it clearer when the automatic output escaping rules are applied (see |
|
|
703 |
the doc for more information). |
|
|
704 |
|
|
|
705 |
* Some methods in the DependencyInjection component's `ContainerBuilder` and |
|
|
706 |
`Definition` classes have been renamed to be more specific and consistent: |
|
|
707 |
|
|
|
708 |
Before: |
|
|
709 |
|
|
|
710 |
$container->remove('my_definition'); |
|
|
711 |
$definition->setArgument(0, 'foo'); |
|
|
712 |
|
|
|
713 |
After: |
|
|
714 |
|
|
|
715 |
$container->removeDefinition('my_definition'); |
|
|
716 |
$definition->replaceArgument(0, 'foo'); |
|
|
717 |
|
|
|
718 |
* In the rememberme configuration, the `token_provider key` now expects a real |
|
|
719 |
service id instead of only a suffix. |
|
|
720 |
|
|
|
721 |
PR11 to PR12 |
|
|
722 |
------------ |
|
|
723 |
|
|
|
724 |
* `HttpFoundation\Cookie::getExpire()` was renamed to `getExpiresTime()` |
|
|
725 |
|
|
|
726 |
* XML configurations have been normalized. All tags with only one attribute |
|
|
727 |
have been converted to tag content: |
|
|
728 |
|
|
|
729 |
Before: |
|
|
730 |
|
|
|
731 |
<bundle name="MyBundle" /> |
|
|
732 |
<app:engine id="twig" /> |
|
|
733 |
<twig:extension id="twig.extension.debug" /> |
|
|
734 |
|
|
|
735 |
After: |
|
|
736 |
|
|
|
737 |
<bundle>MyBundle</bundle> |
|
|
738 |
<app:engine>twig</app:engine> |
|
|
739 |
<twig:extension>twig.extension.debug</twig:extension> |
|
|
740 |
|
|
|
741 |
* Fixes a critical security issue which allowed all users to switch to |
|
|
742 |
arbitrary accounts when the SwitchUserListener was activated. Configurations |
|
|
743 |
which do not use the SwitchUserListener are not affected. |
|
|
744 |
|
|
|
745 |
* The Dependency Injection Container now strongly validates the references of |
|
|
746 |
all your services at the end of its compilation process. If you have invalid |
|
|
747 |
references this will result in a compile-time exception instead of a run-time |
|
|
748 |
exception (the previous behavior). |
|
|
749 |
|
|
|
750 |
PR10 to PR11 |
|
|
751 |
------------ |
|
|
752 |
|
|
|
753 |
* Extension configuration classes should now implement the |
|
|
754 |
`Symfony\Component\Config\Definition\ConfigurationInterface` interface. Note |
|
|
755 |
that the BC is kept but implementing this interface in your extensions will |
|
|
756 |
allow for further developments. |
|
|
757 |
|
|
|
758 |
* The `fingerscrossed` Monolog option has been renamed to `fingers_crossed`. |
|
|
759 |
|
|
|
760 |
PR9 to PR10 |
|
|
761 |
----------- |
|
|
762 |
|
|
|
763 |
* Bundle logical names earned back their `Bundle` suffix: |
|
|
764 |
|
|
|
765 |
*Controllers*: `Blog:Post:show` -> `BlogBundle:Post:show` |
|
|
766 |
|
|
|
767 |
*Templates*: `Blog:Post:show.html.twig` -> `BlogBundle:Post:show.html.twig` |
|
|
768 |
|
|
|
769 |
*Resources*: `@Blog/Resources/config/blog.xml` -> `@BlogBundle/Resources/config/blog.xml` |
|
|
770 |
|
|
|
771 |
*Doctrine*: `$em->find('Blog:Post', $id)` -> `$em->find('BlogBundle:Post', $id)` |
|
|
772 |
|
|
|
773 |
* `ZendBundle` has been replaced by `MonologBundle`. Have a look at the |
|
|
774 |
changes made to Symfony SE to see how to upgrade your projects: |
|
|
775 |
https://github.com/symfony/symfony-standard/pull/30/files |
|
|
776 |
|
|
|
777 |
* Almost all core bundles parameters have been removed. You should use the |
|
|
778 |
settings exposed by the bundle extension configuration instead. |
|
|
779 |
|
|
|
780 |
* Some core bundles service names changed for better consistency. |
|
|
781 |
|
|
|
782 |
* Namespace for validators has changed from `validation` to `assert` (it was |
|
|
783 |
announced for PR9 but it was not the case then): |
|
|
784 |
|
|
|
785 |
Before: |
|
|
786 |
|
|
|
787 |
@validation:NotNull |
|
|
788 |
|
|
|
789 |
After: |
|
|
790 |
|
|
|
791 |
@assert:NotNull |
|
|
792 |
|
|
|
793 |
Moreover, the `Assert` prefix used for some constraints has been removed |
|
|
794 |
(`AssertTrue` to `True`). |
|
|
795 |
|
|
|
796 |
* `ApplicationTester::getDisplay()` and `CommandTester::getDisplay()` method |
|
|
797 |
now return the command exit code |
|
|
798 |
|
|
|
799 |
PR8 to PR9 |
|
|
800 |
---------- |
|
|
801 |
|
|
|
802 |
* `Symfony\Bundle\FrameworkBundle\Util\Filesystem` has been moved to |
|
|
803 |
`Symfony\Component\HttpKernel\Util\Filesystem` |
|
|
804 |
|
|
|
805 |
* The `Execute` constraint has been renamed to `Callback` |
|
|
806 |
|
|
|
807 |
* The HTTP exceptions classes signatures have changed: |
|
|
808 |
|
|
|
809 |
Before: |
|
|
810 |
|
|
|
811 |
throw new NotFoundHttpException('Not Found', $message, 0, $e); |
|
|
812 |
|
|
|
813 |
After: |
|
|
814 |
|
|
|
815 |
throw new NotFoundHttpException($message, $e); |
|
|
816 |
|
|
|
817 |
* The RequestMatcher class does not add `^` and `$` anymore to regexp. |
|
|
818 |
|
|
|
819 |
You need to update your security configuration accordingly for instance: |
|
|
820 |
|
|
|
821 |
Before: |
|
|
822 |
|
|
|
823 |
pattern: /_profiler.* |
|
|
824 |
pattern: /login |
|
|
825 |
|
|
|
826 |
After: |
|
|
827 |
|
|
|
828 |
pattern: ^/_profiler |
|
|
829 |
pattern: ^/login$ |
|
|
830 |
|
|
|
831 |
* Global templates under `app/` moved to a new location (old directory did not |
|
|
832 |
work anyway): |
|
|
833 |
|
|
|
834 |
Before: |
|
|
835 |
|
|
|
836 |
app/views/base.html.twig |
|
|
837 |
app/views/AcmeDemoBundle/base.html.twig |
|
|
838 |
|
|
|
839 |
After: |
|
|
840 |
|
|
|
841 |
app/Resources/views/base.html.twig |
|
|
842 |
app/Resources/AcmeDemo/views/base.html.twig |
|
|
843 |
|
|
|
844 |
* Bundle logical names lose their `Bundle` suffix: |
|
|
845 |
|
|
|
846 |
*Controllers*: `BlogBundle:Post:show` -> `Blog:Post:show` |
|
|
847 |
|
|
|
848 |
*Templates*: `BlogBundle:Post:show.html.twig` -> `Blog:Post:show.html.twig` |
|
|
849 |
|
|
|
850 |
*Resources*: `@BlogBundle/Resources/config/blog.xml` -> `@Blog/Resources/config/blog.xml` |
|
|
851 |
|
|
|
852 |
*Doctrine*: `$em->find('BlogBundle:Post', $id)` -> `$em->find('Blog:Post', $id)` |
|
|
853 |
|
|
|
854 |
* Assetic filters must be now explicitly loaded: |
|
|
855 |
|
|
|
856 |
assetic: |
|
|
857 |
filters: |
|
|
858 |
cssrewrite: ~ |
|
|
859 |
yui_css: |
|
|
860 |
jar: "/path/to/yuicompressor.jar" |
|
|
861 |
my_filter: |
|
|
862 |
resource: "%kernel.root_dir%/config/my_filter.xml" |
|
|
863 |
foo: bar |