Skip to content

Commit f5f3c1b

Browse files
committed
minor #4865 Removed literals for bundle names (WouterJ)
This PR was merged into the 2.3 branch. Discussion ---------- Removed literals for bundle names *Note: Most of it was automated and I didn't review it closely yet (since I didn't know the general opinion on this topic), so there can be some faulty changes.* I always like to use as less literals as possible, as I think it makes sentences harder to understand. That's why I strongly believe that literals should exclusively be used for code. As a bundle name is not code, I propose to remove all literals around bundle names. | Q | A | --- | --- | Doc fix? | yes | New docs? | nope | Applies to | all | Fixed tickets | - Commits ------- f361c87 Removed literals for bundle names
2 parents a6b7d72 + f361c87 commit f5f3c1b

23 files changed

+94
-96
lines changed

Diff for: best_practices/business-logic.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ your app that's not specific to the framework (e.g. routing and controllers).
1010
Domain classes, Doctrine entities and regular PHP classes that are used as
1111
services are good examples of business logic.
1212

13-
For most projects, you should store everything inside the ``AppBundle``.
13+
For most projects, you should store everything inside the AppBundle.
1414
Inside here, you can create whatever directories you want to organize things:
1515

1616
.. code-block:: text
@@ -45,7 +45,7 @@ and put things there:
4545
4646
.. tip::
4747

48-
The recommended approach of using the ``AppBundle`` directory is for
48+
The recommended approach of using the ``AppBundle/`` directory is for
4949
simplicity. If you're advanced enough to know what needs to live in
5050
a bundle and what can live outside of one, then feel free to do that.
5151

@@ -166,8 +166,8 @@ library or strategy you want for this.
166166

167167
In practice, many Symfony applications rely on the independent
168168
`Doctrine project`_ to define their model using entities and repositories.
169-
Just like with business logic, we recommend storing Doctrine entities in
170-
the ``AppBundle``
169+
Just like with business logic, we recommend storing Doctrine entities in the
170+
AppBundle.
171171

172172
The three entities defined by our sample blog application are a good example:
173173

Diff for: best_practices/controllers.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ into a service.
1313

1414
.. best-practice::
1515

16-
Make your controller extend the ``FrameworkBundle`` base Controller and
17-
use annotations to configure routing, caching and security whenever possible.
16+
Make your controller extend the FrameworkBundle base controller and use
17+
annotations to configure routing, caching and security whenever possible.
1818

1919
Coupling the controllers to the underlying framework allows you to leverage
2020
all of its features and increases your productivity.

Diff for: best_practices/creating-the-project.rst

+11-11
Original file line numberDiff line numberDiff line change
@@ -109,26 +109,26 @@ Application Bundles
109109

110110
When Symfony 2.0 was released, most developers naturally adopted the symfony
111111
1.x way of dividing applications into logical modules. That's why many Symfony
112-
apps use bundles to divide their code into logical features: ``UserBundle``,
113-
``ProductBundle``, ``InvoiceBundle``, etc.
112+
apps use bundles to divide their code into logical features: UserBundle,
113+
ProductBundle, InvoiceBundle, etc.
114114

115115
But a bundle is *meant* to be something that can be reused as a stand-alone
116-
piece of software. If ``UserBundle`` cannot be used *"as is"* in other Symfony
117-
apps, then it shouldn't be its own bundle. Moreover ``InvoiceBundle`` depends
118-
on ``ProductBundle``, then there's no advantage to having two separate bundles.
116+
piece of software. If UserBundle cannot be used *"as is"* in other Symfony
117+
apps, then it shouldn't be its own bundle. Moreover InvoiceBundle depends on
118+
ProductBundle, then there's no advantage to having two separate bundles.
119119

120120
.. best-practice::
121121

122-
Create only one bundle called ``AppBundle`` for your application logic
122+
Create only one bundle called AppBundle for your application logic
123123

124-
Implementing a single ``AppBundle`` bundle in your projects will make your code
124+
Implementing a single AppBundle bundle in your projects will make your code
125125
more concise and easier to understand. Starting in Symfony 2.6, the official
126-
Symfony documentation uses the ``AppBundle`` name.
126+
Symfony documentation uses the AppBundle name.
127127

128128
.. note::
129129

130-
There is no need to prefix the ``AppBundle`` with your own vendor (e.g.
131-
``AcmeAppBundle``), because this application bundle is never going to be
130+
There is no need to prefix the AppBundle with your own vendor (e.g.
131+
AcmeAppBundle), because this application bundle is never going to be
132132
shared.
133133

134134
All in all, this is the typical directory structure of a Symfony application
@@ -152,7 +152,7 @@ that follows these best practices:
152152
153153
.. tip::
154154

155-
If your Symfony installation doesn't come with a pre-generated ``AppBundle``,
155+
If your Symfony installation doesn't come with a pre-generated AppBundle,
156156
you can generate it by hand executing this command:
157157

158158
.. code-block:: bash

Diff for: book/controller.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,9 @@ Simple, right?
228228
Route Parameters as Controller Arguments
229229
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
230230

231-
You already know that the route points to the ``HelloController::indexAction()`` method
232-
that lives inside ``AppBundle``. What's more interesting is the argument
233-
that is passed to that method::
231+
You already know that the route points to the
232+
``HelloController::indexAction()`` method that lives inside AppBundle. What's
233+
more interesting is the argument that is passed to that method::
234234

235235
// src/AppBundle/Controller/HelloController.php
236236
// ...
@@ -768,8 +768,8 @@ object that's returned from *that* controller::
768768
Notice that the ``forward()`` method uses a special string representation
769769
of the controller (see :ref:`controller-string-syntax`). In this case, the
770770
target controller function will be ``SomethingController::fancyAction()``
771-
inside the ``AppBundle``. The array passed to the method becomes the arguments
772-
on the resulting controller. This same idea is used when embedding controllers
771+
inside the AppBundle. The array passed to the method becomes the arguments on
772+
the resulting controller. This same idea is used when embedding controllers
773773
into templates (see :ref:`templating-embedding-controller`). The target
774774
controller method would look something like this::
775775

Diff for: book/doctrine.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ Creating an Entity Class
197197
Suppose you're building an application where products need to be displayed.
198198
Without even thinking about Doctrine or databases, you already know that
199199
you need a ``Product`` object to represent those products. Create this class
200-
inside the ``Entity`` directory of your ``AppBundle``::
200+
inside the ``Entity`` directory of your AppBundle::
201201

202202
// src/AppBundle/Entity/Product.php
203203
namespace AppBundle\Entity;

Diff for: book/page_creation.rst

+21-20
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ to a specific feature, including PHP classes, configuration, and even stylesheet
101101
and JavaScript files (see :ref:`page-creation-bundles`).
102102

103103
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
105105
if there is a ``DemoBundle/`` directory inside an ``Acme/`` directory. If those
106106
directories already exist, skip the rest of this section and go directly to
107107
create the route.
108108

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
110110
build in this chapter), run the following command and follow the on-screen
111111
instructions (use all the default options):
112112

@@ -140,8 +140,8 @@ By default, the routing configuration file in a Symfony application is
140140
located at ``app/config/routing.yml``. Like all configuration in Symfony,
141141
you can also choose to use XML or PHP out of the box to configure routes.
142142

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:
145145

146146
.. configuration-block::
147147

@@ -181,9 +181,10 @@ an entry when you generated the ``AcmeDemoBundle``:
181181
182182
This entry is pretty basic: it tells Symfony to load routing configuration
183183
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.
187188

188189
.. note::
189190

@@ -255,7 +256,7 @@ that controller.
255256
The controller - ``AcmeDemoBundle:Random:index`` is the *logical* name of
256257
the controller, and it maps to the ``indexAction`` method of a PHP class
257258
called ``Acme\DemoBundle\Controller\RandomController``. Start by creating this
258-
file inside your ``AcmeDemoBundle``::
259+
file inside your AcmeDemoBundle::
259260

260261
// src/Acme/DemoBundle/Controller/RandomController.php
261262
namespace Acme\DemoBundle\Controller;
@@ -388,7 +389,7 @@ location using the following convention.
388389

389390
**/path/to/BundleName**/Resources/views/**ControllerName**/**TemplateName**
390391

391-
In this case, ``AcmeDemoBundle`` is the bundle name, ``Random`` is the
392+
In this case, AcmeDemoBundle is the bundle name, ``Random`` is the
392393
controller, and ``index.html.twig`` the template:
393394

394395
.. configuration-block::
@@ -636,7 +637,7 @@ in your application and to optimize them the way you want.
636637
to the organization and best practices of :doc:`bundles </cookbook/bundles/best_practices>`.
637638

638639
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
640641
a bundle for user management (many of these exist already as open source
641642
bundles). Each directory contains everything related to that feature, including
642643
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
685686
bundle for you. Of course, creating a bundle by hand is pretty easy as well.
686687

687688
To show you how simple the bundle system is, create a new bundle called
688-
``AcmeTestBundle`` and enable it.
689+
AcmeTestBundle and enable it.
689690

690691
.. tip::
691692

692693
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``).
695696

696697
Start by creating a ``src/Acme/TestBundle/`` directory and adding a new file
697698
called ``AcmeTestBundle.php``::
@@ -707,9 +708,10 @@ called ``AcmeTestBundle.php``::
707708

708709
.. tip::
709710

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``).
713715

714716
This empty class is the only piece you need to create the new bundle. Though
715717
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::
730732
return $bundles;
731733
}
732734

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.
735736

736737
And as easy as this is, Symfony also provides a command-line interface for
737738
generating a basic bundle skeleton:
@@ -755,8 +756,8 @@ Bundle Directory Structure
755756

756757
The directory structure of a bundle is simple and flexible. By default, the
757758
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:
760761

761762
``Controller/``
762763
Contains the controllers of the bundle (e.g. ``RandomController.php``).

Diff for: book/propel.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ persist it to the database and fetch it back out.
1818
.. sidebar:: Code along with the Example
1919

2020
If you want to follow along with the example in this chapter, create an
21-
``AcmeStoreBundle`` via:
21+
AcmeStoreBundle via:
2222

2323
.. code-block:: bash
2424
@@ -86,7 +86,7 @@ generated by Propel contain some business logic.
8686

8787
Suppose you're building an application where products need to be displayed.
8888
First, create a ``schema.xml`` file inside the ``Resources/config`` directory
89-
of your ``AcmeStoreBundle``:
89+
of your AcmeStoreBundle:
9090

9191
.. code-block:: xml
9292
@@ -129,7 +129,7 @@ After creating your ``schema.xml``, generate your model from it by running:
129129
$ php app/console propel:model:build
130130
131131
This generates each model class to quickly develop your application in the
132-
``Model/`` directory of the ``AcmeStoreBundle`` bundle.
132+
``Model/`` directory of the AcmeStoreBundle bundle.
133133

134134
Creating the Database Tables/Schema
135135
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Diff for: book/service_container.rst

+6-7
Original file line numberDiff line numberDiff line change
@@ -333,12 +333,12 @@ Importing Configuration with ``imports``
333333

334334
So far, you've placed your ``my_mailer`` service container definition directly
335335
in the application configuration file (e.g. ``app/config/config.yml``). Of
336-
course, since the ``Mailer`` class itself lives inside the ``AcmeHelloBundle``,
337-
it makes more sense to put the ``my_mailer`` container definition inside the
336+
course, since the ``Mailer`` class itself lives inside the AcmeHelloBundle, it
337+
makes more sense to put the ``my_mailer`` container definition inside the
338338
bundle as well.
339339

340340
First, move the ``my_mailer`` container definition into a new container resource
341-
file inside ``AcmeHelloBundle``. If the ``Resources`` or ``Resources/config``
341+
file inside AcmeHelloBundle. If the ``Resources`` or ``Resources/config``
342342
directories don't exist, create them.
343343

344344
.. configuration-block::
@@ -423,10 +423,9 @@ configuration.
423423
The ``imports`` directive allows your application to include service container
424424
configuration resources from any other location (most commonly from bundles).
425425
The ``resource`` location, for files, is the absolute path to the resource
426-
file. The special ``@AcmeHello`` syntax resolves the directory path of
427-
the ``AcmeHelloBundle`` bundle. This helps you specify the path to the resource
428-
without worrying later if you move the ``AcmeHelloBundle`` to a different
429-
directory.
426+
file. The special ``@AcmeHello`` syntax resolves the directory path of the
427+
AcmeHelloBundle bundle. This helps you specify the path to the resource without
428+
worrying later if you move the AcmeHelloBundle to a different directory.
430429

431430
.. index::
432431
single: Service Container; Extension configuration

Diff for: book/templating.rst

+12-12
Original file line numberDiff line numberDiff line change
@@ -415,27 +415,27 @@ templates, each which lives in a specific location:
415415
template for a specific page. The three parts of the string, each separated
416416
by a colon (``:``), mean the following:
417417

418-
* ``AcmeBlogBundle``: (*bundle*) the template lives inside the
419-
``AcmeBlogBundle`` (e.g. ``src/Acme/BlogBundle``);
418+
* ``AcmeBlogBundle``: (*bundle*) the template lives inside the AcmeBlogBundle
419+
(e.g. ``src/Acme/BlogBundle``);
420420

421421
* ``Blog``: (*directory*) indicates that the template lives inside the
422422
``Blog`` subdirectory of ``Resources/views``;
423423

424424
* ``index.html.twig``: (*filename*) the actual name of the file is
425425
``index.html.twig``.
426426

427-
Assuming that the ``AcmeBlogBundle`` lives at ``src/Acme/BlogBundle``, the
427+
Assuming that the AcmeBlogBundle lives at ``src/Acme/BlogBundle``, the
428428
final path to the layout would be ``src/Acme/BlogBundle/Resources/views/Blog/index.html.twig``.
429429

430430
* ``AcmeBlogBundle::layout.html.twig``: This syntax refers to a base template
431-
that's specific to the ``AcmeBlogBundle``. Since the middle, "directory",
432-
portion is missing (e.g. ``Blog``), the template lives at
433-
``Resources/views/layout.html.twig`` inside ``AcmeBlogBundle``.
434-
Yes, there are 2 colons in the middle of the string when the "controller"
435-
subdirectory part is missing.
431+
that's specific to the AcmeBlogBundle. Since the middle, "directory", portion
432+
is missing (e.g. ``Blog``), the template lives at
433+
``Resources/views/layout.html.twig`` inside AcmeBlogBundle. Yes, there are 2
434+
colons in the middle of the string when the "controller" subdirectory part is
435+
missing.
436436

437437
In the :ref:`overriding-bundle-templates` section, you'll find out how each
438-
template living inside the ``AcmeBlogBundle``, for example, can be overridden
438+
template living inside the AcmeBlogBundle, for example, can be overridden
439439
by placing a template of the same name in the ``app/Resources/AcmeBlogBundle/views/``
440440
directory. This gives the power to override templates from any vendor bundle.
441441

@@ -1247,10 +1247,10 @@ bundles (see `KnpBundles.com`_) for a large number of different features.
12471247
Once you use a third-party bundle, you'll likely need to override and customize
12481248
one or more of its templates.
12491249

1250-
Suppose you've installed the imaginary open-source ``AcmeBlogBundle`` in your
1250+
Suppose you've installed the imaginary open-source AcmeBlogBundle in your
12511251
project. And while you're really happy with everything, you want to override
12521252
the blog "list" page to customize the markup specifically for your application.
1253-
By digging into the ``Blog`` controller of the ``AcmeBlogBundle``, you find the
1253+
By digging into the ``Blog`` controller of the AcmeBlogBundle, you find the
12541254
following::
12551255

12561256
public function indexAction()
@@ -1281,7 +1281,7 @@ to create it). You're now free to customize the template.
12811281
cache (``php app/console cache:clear``), even if you are in debug mode.
12821282

12831283
This logic also applies to base bundle templates. Suppose also that each
1284-
template in ``AcmeBlogBundle`` inherits from a base template called
1284+
template in AcmeBlogBundle inherits from a base template called
12851285
``AcmeBlogBundle::layout.html.twig``. Just as before, Symfony will look in
12861286
the following two places for the template:
12871287

Diff for: components/console/helpers/dialoghelper.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ if you want to know a bundle name, you can add this to your command::
5454
The user will be asked "Please enter the name of the bundle". They can type
5555
some name which will be returned by the
5656
:method:`Symfony\\Component\\Console\\Helper\\DialogHelper::ask` method.
57-
If they leave it empty, the default value (``AcmeDemoBundle`` here) is returned.
57+
If they leave it empty, the default value (AcmeDemoBundle here) is returned.
5858

5959
Autocompletion
6060
~~~~~~~~~~~~~~

Diff for: cookbook/assetic/asset_management.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ To include JavaScript files, use the ``javascripts`` tag in any template:
9292
You can also include CSS Stylesheets: see :ref:`cookbook-assetic-including-css`.
9393

9494
In this example, all of the files in the ``Resources/public/js/`` directory
95-
of the ``AppBundle`` will be loaded and served from a different location.
95+
of the AppBundle will be loaded and served from a different location.
9696
The actual rendered tag might simply look like:
9797

9898
.. code-block:: html

Diff for: cookbook/assetic/uglifyjs.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,9 @@ your assets are a part of the view layer, this work is done in your templates:
176176
177177
.. note::
178178

179-
The above example assumes that you have a bundle called ``AppBundle``
180-
and your JavaScript files are in the ``Resources/public/js`` directory under
181-
your bundle. This isn't important however - you can include your JavaScript
179+
The above example assumes that you have a bundle called AppBundle and your
180+
JavaScript files are in the ``Resources/public/js`` directory under your
181+
bundle. This isn't important however - you can include your JavaScript
182182
files no matter where they are.
183183

184184
With the addition of the ``uglifyjs2`` filter to the asset tags above, you

Diff for: cookbook/assetic/yuicompressor.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ the view layer, this work is done in your templates:
106106
107107
.. note::
108108

109-
The above example assumes that you have a bundle called ``AppBundle``
110-
and your JavaScript files are in the ``Resources/public/js`` directory under
111-
your bundle. This isn't important however - you can include your JavaScript
109+
The above example assumes that you have a bundle called AppBundle and your
110+
JavaScript files are in the ``Resources/public/js`` directory under your
111+
bundle. This isn't important however - you can include your JavaScript
112112
files no matter where they are.
113113

114114
With the addition of the ``yui_js`` filter to the asset tags above, you should

0 commit comments

Comments
 (0)