Skip to content

Commit 6a90c9b

Browse files
committed
Created 'upgrade' cookbook section
1 parent 0dc6204 commit 6a90c9b

File tree

8 files changed

+127
-144
lines changed

8 files changed

+127
-144
lines changed

cookbook/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The Cookbook
2828
symfony1
2929
templating/index
3030
testing/index
31-
upgrading
31+
upgrade/index
3232
validation/index
3333
web_server/index
3434
web_services/index

cookbook/map.rst.inc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,10 @@
201201
* (email) :doc:`/cookbook/email/testing`
202202
* (form) :doc:`/cookbook/form/unit_testing`
203203

204-
* **Upgrading**
204+
* :doc:`/cookbook/upgrading/index`
205205

206-
* :doc:`/cookbook/upgrading`
206+
* :doc:`/cookbook/upgrading/patch_version`
207+
* :doc:`/cookbook/upgrading/minor_version`
207208

208209
* :doc:`/cookbook/validation/index`
209210

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
You may also want to upgrade the rest of your libraries. If you've done a
2+
good job with your `version constraints`_ in ``composer.json``, you can do
3+
this safely by running:
4+
5+
.. code-block:: bash
6+
7+
$ composer update
8+
9+
.. caution::
10+
11+
Beware, if you have some bad `version constraints`_ in your
12+
``composer.json`` (e.g. ``dev-master``), this could upgrade some
13+
non-Symfony libraries to new versions that contain backwards-compatibility
14+
breaking changes.
15+
16+
.. _`versino constraints`: https://getcomposer.org/doc/01-basic-usage.md#package-versions

cookbook/upgrade/index.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.. index::
2+
single: Upgrading
3+
4+
Upgrading
5+
=========
6+
7+
So a new Symfony release has come out and you want to upgrade, great! Fortunately,
8+
because Symfony protects backwards-compatibility very closely, this *should*
9+
be quite easy.
10+
11+
There are three types of upgrades, all needing a little different preparation:
12+
13+
.. toctree::
14+
:maxdepth: 2
15+
16+
/cookbook/upgrade/patch_version
17+
/cookbook/upgrade/minor_version

cookbook/upgrade/minor_version.rst

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
.. index::
2+
single: Upgrading; Minor Version
3+
4+
Upgrading a Minor Version (e.g. 2.5.3 to 2.6.1)
5+
===============================================
6+
7+
If you're upgrading a minor version (where the middle number changes), then
8+
you should *not* encounter significant backwards compatibility changes. For
9+
details, see the :doc:`Symfony backwards compatibility promise </contributing/code/bc>`.
10+
11+
However, some backwards-compatibility breaks *are* possible and you'll learn in
12+
a second how to prepare for them.
13+
14+
There are two steps to upgrading a minor version:
15+
16+
#. :ref:`Update the Symfony library via Composer <upgrade-minor-symfony-composer>`;
17+
#. :ref:`Update your code to work with the new version <upgrade-minor-symfony-code>`.
18+
19+
.. _`upgrade-minor-symfony-composer`:
20+
21+
1) Update the Symfony Library via Composer
22+
------------------------------------------
23+
24+
First, you need to update Symfony by modifying your ``composer.json`` file
25+
to use the new version:
26+
27+
.. code-block:: json
28+
29+
{
30+
"...": "...",
31+
32+
"require": {
33+
"symfony/symfony": "2.6.*",
34+
},
35+
"...": "...",
36+
}
37+
38+
Next, use Composer to download new versions of the libraries:
39+
40+
.. code-block:: bash
41+
42+
$ composer update symfony/symfony
43+
44+
.. include:: /cookbook/upgrade/_update_all_packages.rst.inc
45+
46+
.. _`upgrade-minor-symfony-code`:
47+
48+
2) Updating Your Code to Work with the new Version
49+
--------------------------------------------------
50+
51+
In theory, you should be done! However, you *may* need to make a few changes
52+
to your code to get everything working. Additionally, some features you're
53+
using might still work, but might now be deprecated. While that's just fine,
54+
if you know about these deprecations, you can start to fix them over time.
55+
56+
Every version of Symfony comes with an UPGRADE file included in the Symfony
57+
directory that describes these changes. If you follow the instructions in the
58+
document and update your code accordingly, it should be save to update in the
59+
future.
60+
61+
These documents can also be found in the `Symfony Repository`_.
62+
63+
.. _`Symfony Repository`: https://github.com/symfony/symfony

cookbook/upgrade/patch_version.rst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
.. index::
2+
single: Upgrading; Patch Version
3+
4+
Upgrading a Patch Version (e.g. 2.6.0 to 2.6.1)
5+
===============================================
6+
7+
When a new patch version is released (only the last number changed), it is a
8+
release that only contains bug fixes. This means that upgrading to a new patch
9+
version is *really* easy:
10+
11+
.. code-block:: bash
12+
13+
$ composer update symfony/symfony
14+
15+
That's it! You should not encounter any backwards-compatibility breaks or
16+
need to change anything else in your code. That's because when you started
17+
your project, your ``composer.json`` included Symfony using a constraint
18+
like ``2.6.*``, where only the *last* version number will change when you
19+
update.
20+
21+
.. tip::
22+
23+
It is recommended to update to a new patch version as soon as possible, as
24+
important bugs and security leaks may be fixed in these new releases.
25+
26+
.. include:: /cookbook/upgrade/_update_all_packages.rst.inc

cookbook/upgrading.rst

Lines changed: 0 additions & 141 deletions
This file was deleted.

redirection_map

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@
2323
/cookbook/console/generating_urls /cookbook/console/sending_emails
2424
/components/yaml /components/yaml/introduction
2525
/components/templating /components/templating/introduction
26+
/cookbook/upgrading /cookbook/upgrade/index

0 commit comments

Comments
 (0)