@@ -101,12 +101,12 @@ to a specific feature, including PHP classes, configuration, and even stylesheet
101
101
and JavaScript files (see :ref: `page-creation-bundles `).
102
102
103
103
Depending on the way you installed Symfony, you may already have a bundle called
104
- `` AcmeDemoBundle `` . Browse the ``src/ `` directory of your project and check
104
+ AcmeDemoBundle. Browse the ``src/ `` directory of your project and check
105
105
if there is a ``DemoBundle/ `` directory inside an ``Acme/ `` directory. If those
106
106
directories already exist, skip the rest of this section and go directly to
107
107
create the route.
108
108
109
- To create a bundle called `` AcmeDemoBundle `` (a play bundle that you'll
109
+ To create a bundle called AcmeDemoBundle (a play bundle that you'll
110
110
build in this chapter), run the following command and follow the on-screen
111
111
instructions (use all the default options):
112
112
@@ -140,8 +140,8 @@ By default, the routing configuration file in a Symfony application is
140
140
located at ``app/config/routing.yml ``. Like all configuration in Symfony,
141
141
you can also choose to use XML or PHP out of the box to configure routes.
142
142
143
- If you look at the main routing file, you'll see that Symfony already added
144
- an entry when you generated the `` AcmeDemoBundle `` :
143
+ If you look at the main routing file, you'll see that Symfony already added an
144
+ entry when you generated the AcmeDemoBundle:
145
145
146
146
.. configuration-block ::
147
147
@@ -181,9 +181,10 @@ an entry when you generated the ``AcmeDemoBundle``:
181
181
182
182
This entry is pretty basic: it tells Symfony to load routing configuration
183
183
from the ``Resources/config/routing.yml `` (``routing.xml `` or ``routing.php ``
184
- in the XML and PHP code example respectively) file that lives inside the ``AcmeDemoBundle ``.
185
- This means that you place routing configuration directly in ``app/config/routing.yml ``
186
- or organize your routes throughout your application, and import them from here.
184
+ in the XML and PHP code example respectively) file that lives inside the
185
+ AcmeDemoBundle. This means that you place routing configuration directly in
186
+ ``app/config/routing.yml `` or organize your routes throughout your application,
187
+ and import them from here.
187
188
188
189
.. note ::
189
190
@@ -255,7 +256,7 @@ that controller.
255
256
The controller - ``AcmeDemoBundle:Random:index `` is the *logical * name of
256
257
the controller, and it maps to the ``indexAction `` method of a PHP class
257
258
called ``Acme\DemoBundle\Controller\RandomController ``. Start by creating this
258
- file inside your `` AcmeDemoBundle `` ::
259
+ file inside your AcmeDemoBundle::
259
260
260
261
// src/Acme/DemoBundle/Controller/RandomController.php
261
262
namespace Acme\DemoBundle\Controller;
@@ -388,7 +389,7 @@ location using the following convention.
388
389
389
390
**/path/to/BundleName **/Resources/views/**ControllerName **/**TemplateName **
390
391
391
- In this case, `` AcmeDemoBundle `` is the bundle name, ``Random `` is the
392
+ In this case, AcmeDemoBundle is the bundle name, ``Random `` is the
392
393
controller, and ``index.html.twig `` the template:
393
394
394
395
.. configuration-block ::
@@ -636,7 +637,7 @@ in your application and to optimize them the way you want.
636
637
to the organization and best practices of :doc: `bundles </cookbook/bundles/best_practices >`.
637
638
638
639
A bundle is simply a structured set of files within a directory that implement
639
- a single feature. You might create a `` BlogBundle `` , a `` ForumBundle `` or
640
+ a single feature. You might create a BlogBundle, a ForumBundle or
640
641
a bundle for user management (many of these exist already as open source
641
642
bundles). Each directory contains everything related to that feature, including
642
643
PHP files, templates, stylesheets, JavaScripts, tests and anything else.
@@ -685,13 +686,13 @@ The Symfony Standard Edition comes with a handy task that creates a fully-functi
685
686
bundle for you. Of course, creating a bundle by hand is pretty easy as well.
686
687
687
688
To show you how simple the bundle system is, create a new bundle called
688
- `` AcmeTestBundle `` and enable it.
689
+ AcmeTestBundle and enable it.
689
690
690
691
.. tip ::
691
692
692
693
The ``Acme `` portion is just a dummy name that should be replaced by
693
- some "vendor" name that represents you or your organization (e.g. `` ABCTestBundle ``
694
- for some company named ``ABC ``).
694
+ some "vendor" name that represents you or your organization (e.g.
695
+ ABCTestBundle for some company named ``ABC ``).
695
696
696
697
Start by creating a ``src/Acme/TestBundle/ `` directory and adding a new file
697
698
called ``AcmeTestBundle.php ``::
@@ -707,9 +708,10 @@ called ``AcmeTestBundle.php``::
707
708
708
709
.. tip ::
709
710
710
- The name ``AcmeTestBundle `` follows the standard :ref: `Bundle naming conventions <bundles-naming-conventions >`.
711
- You could also choose to shorten the name of the bundle to simply ``TestBundle ``
712
- by naming this class ``TestBundle `` (and naming the file ``TestBundle.php ``).
711
+ The name AcmeTestBundle follows the standard
712
+ :ref: `Bundle naming conventions <bundles-naming-conventions >`. You could
713
+ also choose to shorten the name of the bundle to simply TestBundle by naming
714
+ this class TestBundle (and naming the file ``TestBundle.php ``).
713
715
714
716
This empty class is the only piece you need to create the new bundle. Though
715
717
commonly empty, this class is powerful and can be used to customize the behavior
@@ -730,8 +732,7 @@ Now that you've created the bundle, enable it via the ``AppKernel`` class::
730
732
return $bundles;
731
733
}
732
734
733
- And while it doesn't do anything yet, ``AcmeTestBundle `` is now ready to
734
- be used.
735
+ And while it doesn't do anything yet, AcmeTestBundle is now ready to be used.
735
736
736
737
And as easy as this is, Symfony also provides a command-line interface for
737
738
generating a basic bundle skeleton:
@@ -755,8 +756,8 @@ Bundle Directory Structure
755
756
756
757
The directory structure of a bundle is simple and flexible. By default, the
757
758
bundle system follows a set of conventions that help to keep code consistent
758
- between all Symfony bundles. Take a look at `` AcmeDemoBundle `` , as it contains
759
- some of the most common elements of a bundle:
759
+ between all Symfony bundles. Take a look at AcmeDemoBundle, as it contains some
760
+ of the most common elements of a bundle:
760
761
761
762
``Controller/ ``
762
763
Contains the controllers of the bundle (e.g. ``RandomController.php ``).
0 commit comments