4
4
How to remove the AcmeDemoBundle
5
5
================================
6
6
7
- The Symfony2 Standard Edition comes with a complete demo, that lives inside a
7
+ The Symfony2 Standard Edition comes with a complete demo that lives inside a
8
8
bundle called ``AcmeDemoBundle ``. It is a great boilerplate to refer to while
9
- starting with your project, but later on the project, it will become usefull
10
- to remove this bundle.
9
+ starting a project, but you'll probably want to eventually remove it.
11
10
12
11
.. tip ::
13
12
14
- This article uses the AcmeDemoBundle as an example, you can use this
15
- article on every bundle you want to remove.
13
+ This article uses the `` AcmeDemoBundle `` as an example, but you can use
14
+ these steps to remove any bundle .
16
15
17
16
1. Unregister the bundle in the ``AppKernel ``
18
17
---------------------------------------------
19
18
20
19
To disconnect the bundle from the framework, you should remove the bundle from
21
20
the ``Appkernel::registerBundles() `` method. The bundle is normally found in
22
21
the ``$bundles `` array but the ``AcmeDemoBundle `` is only registered in a
23
- development environment and you can find him in the if statement thereafter ::
22
+ development environment and you can find him in the if statement after ::
24
23
25
24
// app/AppKernel.php
26
25
@@ -42,7 +41,7 @@ development environment and you can find him in the if statement thereafter::
42
41
2. Remove bundle configuration
43
42
------------------------------
44
43
45
- Now Symfony doesn't know about the bundle, you need to remove any
44
+ Now that Symfony doesn't know about the bundle, you need to remove any
46
45
configuration and routing configuration inside the ``app/config `` directory
47
46
that refers to the bundle.
48
47
@@ -51,53 +50,57 @@ that refers to the bundle.
51
50
52
51
The routing for the AcmeDemoBundle can be found in
53
52
``app/config/routing_dev.yml ``. The routes are ``_welcome ``, ``_demo_secured ``
54
- and ``_demo ``.
53
+ and ``_demo ``. Remove all three of these entries.
55
54
56
55
2.2 Remove bundle configuration
57
56
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
58
57
59
- Some bundles contains configuration in one of the ``app/config/config*.yml ``
58
+ Some bundles contain configuration in one of the ``app/config/config*.yml ``
60
59
files. Be sure to remove the related configuration from these files. You can
61
60
quickly spot bundle configuration by looking at a ``acme_demo `` (or whatever
62
- the name of the bundle is, e.g. ``fos_user `` with the FOSUserBundle) string in
61
+ the name of the bundle is, e.g. ``fos_user `` for the `` FOSUserBundle `` ) string in
63
62
the configuration files.
64
63
65
- The AcmeDemoBundle doesn't have configuration. However, the bundle has set up
66
- the ``app/config/security.yml `` file. You can use it as a boilerplate for your
67
- own security, but you **can ** also remove everything: It doesn't make sense to
68
- Symfony if you remove it or not.
64
+ The `` AcmeDemoBundle `` doesn't have configuration. However, the bundle is
65
+ used in the configuration for the ``app/config/security.yml `` file. You can
66
+ use it as a boilerplate for your own security, but you **can ** also remove
67
+ everything: it doesn't matter to Symfony if you remove it or not.
69
68
70
- 3. Remove integration in other bundles
71
- --------------------------------------
69
+ 3. Remove the bundle from the Filesystem
70
+ ----------------------------------------
72
71
73
- Some bundles rely on other bundles, if you remove one of the two, the other
74
- will properbly not work. Be sure that no other bundles, third party or self
75
- made, relies on the bundle you are about to remove.
72
+ Now you have removed every reference to the bundle in your application, you
73
+ should remove the bundle from the filesystem. The bundle is located in the
74
+ ``src/Acme/DemoBundle `` directory. You should remove this directory and you
75
+ can remove the ``Acme `` directory as well.
76
76
77
77
.. tip ::
78
78
79
- If a bundle relies on another bundle, it means in most of the cases that
80
- it uses some services from the other bundle. Searching for a `` acme_demo ``
81
- string will help you spot them.
79
+ If you don't know the location of a bundle, you can use the
80
+ :method: ` Symfony \\ Bundle \\ FrameworkBundle \\ Bundle \\ Bundle::getPath ` method
81
+ to get the path of the bundle::
82
82
83
- .. tip ::
83
+ echo $this->container->get('kernel')->getBundle('AcmeDemoBundle')->getPath();
84
+
85
+ 4. Remove integration in other bundles
86
+ --------------------------------------
84
87
85
- If a third party bundle relies on another bundle, you can find the bundle
86
- in the ``composer.json `` file included in the bundle directory.
88
+ .. note ::
87
89
88
- 4. Remove the bundle from the filesystem
89
- ----------------------------------------
90
+ This doesn't apply to the `` AcmeDemoBundle `` - no other bundles depend
91
+ on it, so you can skip this step.
90
92
91
- Now you have removed every reference to the bundle in the Symfony2
92
- application, the last thing you should do is removing the bundle from the file
93
- system. The bundle is located in the ``src/Acme/DemoBundle `` directory. You
94
- should remove this directory and you can remove the ``Acme `` directory as
95
- well, you likely won't get other bundles in that vendor.
93
+ Some bundles rely on other bundles, if you remove one of the two, the other
94
+ will probably not work. Be sure that no other bundles, third party or self-made,
95
+ rely on the bundle you are about to remove.
96
96
97
97
.. tip ::
98
98
99
- If you don't know the location of a bundle, you can use the
100
- :method: ` Symfony \\ Bundle \\ FrameworkBundle \\ Bundle \\ Bundle::getPath ` method
101
- to get the path of the bundle::
99
+ If one bundle relies on another, in most it means that it uses some services
100
+ from the bundle. Searching for a `` acme_demo `` string may help you spot
101
+ them.
102
102
103
- echo $this->container->get('kernel')->getBundle('AcmeDemoBundle')->getPath();
103
+ .. tip ::
104
+
105
+ If a third party bundle relies on another bundle, you can find that bundle
106
+ mentioned in the ``composer.json `` file included in the bundle directory.
0 commit comments