This document explains how to upgrade from one Symfony2 PR version to the next one. It only discusses changes that need to be done when using the "public" API of the framework. If you "hack" the core, you should probably follow the timeline closely anyway.
-
XML configurations have been normalized. All tags with only one attribute have been converted to tag content:
Before:
<bundle name="MyBundle" /> <app:engine id="twig" /> <twig:extension id="twig.extension.debug" />After:
<bundle>MyBundle</bundle> <app:engine>twig</app:engine> <twig:extension>twig.extension.debug</twig:extension>
-
Extension configuration classes should now implement the
Symfony\Component\Config\Definition\ConfigurationInterfaceinterface. Note that the BC is kept but implementing this interface in your extensions will allow for further developments. -
The "fingerscrossed" Monolog option has been renamed to "fingers_crossed".
-
Bundle logical names earned back their
Bundlesuffix:Controllers:
Blog:Post:show->BlogBundle:Post:showTemplates:
Blog:Post:show.html.twig->BlogBundle:Post:show.html.twigResources:
@Blog/Resources/config/blog.xml->@BlogBundle/Resources/config/blog.xmlDoctrine:
$em->find('Blog:Post', $id)->$em->find('BlogBundle:Post', $id) -
ZendBundlehas been replaced byMonologBundle. Have a look at the changes made to Symfony SE to see how to upgrade your projects: https://github.com/symfony/symfony-standard/pull/30/files -
Almost all core bundles parameters have been removed. You should use the settings exposed by the bundle extension configuration instead.
-
Some core bundles service names changed for better consistency.
-
Namespace for validators has changed from
validationtoassert(it was announced for PR9 but it was not the case then):Before:
@validation:NotNullAfter:
@assert:NotNullMoreover, the
Assertprefix used for some constraints has been removed (AssertTruetoTrue). -
ApplicationTester::getDisplay()andCommandTester::getDisplay()method now return the command exit code
-
Symfony\Bundle\FrameworkBundle\Util\Filesystemhas been moved toSymfony\Component\HttpKernel\Util\Filesystem -
The
Executeconstraint has been renamed toCallback -
The HTTP exceptions classes signatures have changed:
Before:
throw new NotFoundHttpException('Not Found', $message, 0, $e);After:
throw new NotFoundHttpException($message, $e); -
The RequestMatcher class does not add
^and$anymore to regexp.You need to update your security configuration accordingly for instance:
Before:
pattern: /_profiler.* pattern: /loginAfter:
pattern: ^/_profiler pattern: ^/login$ -
Global templates under
app/moved to a new location (old directory did not work anyway):Before:
app/views/base.html.twig app/views/AcmeDemoBundle/base.html.twigAfter:
app/Resources/views/base.html.twig app/Resources/AcmeDemo/views/base.html.twig -
Bundle logical names lose their
Bundlesuffix:Controllers:
BlogBundle:Post:show->Blog:Post:showTemplates:
BlogBundle:Post:show.html.twig->Blog:Post:show.html.twigResources:
@BlogBundle/Resources/config/blog.xml->@Blog/Resources/config/blog.xmlDoctrine:
$em->find('BlogBundle:Post', $id)->$em->find('Blog:Post', $id) -
Assetic filters must be now explicitly loaded:
assetic: filters: cssrewrite: ~ yui_css: jar: "/path/to/yuicompressor.jar" my_filter: resource: "%kernel.root_dir%/config/my_filter.xml" foo: bar