8000 Replaced "AcmeWebsiteBundle" by "AcmeDemoBundle" · linaori/symfony-docs@1c01b49 · GitHub
[go: up one dir, main page]

Skip to content
Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1c01b49

Browse files
committed
Replaced "AcmeWebsiteBundle" by "AcmeDemoBundle"
1 parent 2345a0e commit 1c01b49

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

book/page_creation.rst

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ The "Random Number" Page
6666

6767
In this chapter, you'll develop an application that can generate random numbers.
6868
When you're finished, the user will be able to get a random number between ``1``
69-
and the upper limit set with the URL:
69+
and the upper limit set by the URL:
7070

7171
.. code-block:: text
7272
@@ -98,15 +98,15 @@ A bundle is nothing more than a directory that houses everything related
9898
to a specific feature, including PHP classes, configuration, and even stylesheets
9999
and JavaScript files (see :ref:`page-creation-bundles`).
100100

101-
To create a bundle called ``AcmeWebsiteBundle`` (a play bundle that you'll
101+
To create a bundle called ``AcmeDemoBundle`` (a play bundle that you'll
102102
build in this chapter), run the following command and follow the on-screen
103103
instructions (use all of the default options):
104104

105105
.. code-block:: bash
106106
107-
$ php app/console generate:bundle --namespace=Acme/WebsiteBundle --format=yml
107+
$ php app/console generate:bundle --namespace=Acme/DemoBundle --format=yml
108108
109-
Behind the scenes, a directory is created for the bundle at ``src/Acme/WebsiteBundle``.
109+
Behind the scenes, a directory is created for the bundle at ``src/Acme/DemoBundle``.
110110
A line is also automatically added to the ``app/AppKernel.php`` file so that
111111
the bundle is registered with the kernel::
112112

@@ -115,7 +115,7 @@ the bundle is registered with the kernel::
115115
{
116116
$bundles = array(
117117
...,
118-
new Acme\WebsiteBundle\AcmeWebsiteBundle(),
118+
new Acme\DemoBundle\AcmeDemoBundle(),
119119
);
120120
// ...
121121

@@ -133,15 +133,15 @@ located at ``app/config/routing.yml``. Like all configuration in Symfony2,
133133
you can also choose to use XML or PHP out of the box to configure routes.
134134

135135
If you look at the main routing file, you'll see that Symfony already added
136-
an entry when you generated the ``AcmeWebsiteBundle``:
136+
an entry when you generated the ``AcmeDemoBundle``:
137137

138138
.. configuration-block::
139139

140140
.. code-block:: yaml
141141
142142
# app/config/routing.yml
143143
acme_website:
144-
resource: "@AcmeWebsiteBundle/Resources/config/routing.yml"
144+
resource: "@AcmeDemoBundle/Resources/config/routing.yml"
145145
prefix: /
146146
147147
.. code-block:: xml
@@ -153,7 +153,7 @@ an entry when you generated the ``AcmeWebsiteBundle``:
153153
xsi:schemaLocation="http://symfony.com/schema/routing
154154
http://symfony.com/schema/routing/routing-1.0.xsd">
155155
156-
<import resource="@AcmeWebsiteBundle/Resources/config/routing.xml"
156+
<import resource="@AcmeDemoBundle/Resources/config/routing.xml"
157157
prefix="/" />
158158
</routes>
159159
@@ -165,14 +165,14 @@ an entry when you generated the ``AcmeWebsiteBundle``:
165165
166166
$collection = new RouteCollection();
167167
$collection->addCollection(
168-
$loader->import('@AcmeWebsiteBundle/Resources/config/routing.php'),
168+
$loader->import('@AcmeDemoBundle/Resources/config/routing.php'),
169169
'/'
170170
);
171171
172172
return $collection;
173173
174174
This entry is pretty basic: it tells Symfony to load routing configuration
175-
from the ``Resources/config/routing.yml`` file that lives inside the ``AcmeWebsiteBundle``.
175+
from the ``Resources/config/routing.yml`` file that lives inside the ``AcmeDemoBundle``.
176176
This means that you place routing configuration directly in ``app/config/routing.yml``
177177
or organize your routes throughout your application, and import them from here.
178178

@@ -183,34 +183,34 @@ the new route that defines the URL of the page that you're about to create:
183183

184184
.. code-block:: yaml
185185
186-
# src/Acme/WebsiteBundle/Resources/config/routing.yml
186+
# src/Acme/DemoBundle/Resources/config/routing.yml
187187
random:
188188
path: /random/{limit}
189-
defaults: { _controller: AcmeWebsiteBundle:Random:index }
189+
defaults: { _controller: AcmeDemoBundle:Random:index }
190190
191191
.. code-block:: xml
192192
193-
<!-- src/Acme/WebsiteBundle/Resources/config/routing.xml -->
193+
<!-- src/Acme/DemoBundle/Resources/config/routing.xml -->
194194
<?xml version="1.0" encoding="UTF-8" ?>
195195
<routes xmlns="http://symfony.com/schema/routing"
196196
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
197197
xsi:schemaLocation="http://symfony.com/schema/routing
198198
http://symfony.com/schema/routing/routing-1.0.xsd">
199199
200200
<route id="random" path="/random/{limit}">
201-
<default key="_controller">AcmeWebsiteBundle:Random:index</default>
201+
<default key="_controller">AcmeDemoBundle:Random:index</default>
202202
</route>
203203
</routes>
204204
205205
.. code-block:: php
206206
207-
// src/Acme/WebsiteBundle/Resources/config/routing.php
207+
// src/Acme/DemoBundle/Resources/config/routing.php
208208
use Symfony\Component\Routing\RouteCollection;
209209
use Symfony\Component\Routing\Route;
210210
211211
$collection = new RouteCollection();
212212
$collection->add('random', new Route('/random/{limit}', array(
213-
'_controller' => 'AcmeWebsiteBundle:Random:index',
213+
'_controller' => 'AcmeDemoBundle:Random:index',
214214
)));
215215
216216
return $collection;
@@ -233,17 +233,17 @@ Step 2: Create the Controller
233233
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
234234

235235
When a URL such as ``/random/10`` is handled by the application, the ``random``
236-
route is matched and the ``AcmeWebsiteBundle:Random:index`` controller is executed
236+
route is matched and the ``AcmeDemoBundle:Random:index`` controller is executed
237237
by the framework. The second step of the page-creation process is to create
238238
that controller.
239239

240-
The controller - ``AcmeWebsiteBundle:Random:index`` is the *logical* name of
240+
The controller - ``AcmeDemoBundle:Random:index`` is the *logical* name of
241241
the controller, and it maps to the ``indexAction`` method of a PHP class
242-
called ``Acme\WebsiteBundle\Controller\RandomController``. Start by creating this
243-
file inside your ``AcmeWebsiteBundle``::
242+
called ``Acme\DemoBundle\Controller\RandomController``. Start by creating this
243+
file inside your ``AcmeDemoBundle``::
244244

245-
// src/Acme/WebsiteBundle/Controller/RandomController.php
246-
namespace Acme\WebsiteBundle\Controller;
245+
// src/Acme/DemoBundle/Controller/RandomController.php
246+
namespace Acme\DemoBundle\Controller;
247247

248248
class RandomController
249249
{
@@ -258,8 +258,8 @@ object.
258258
Create the ``indexAction`` method that Symfony will execute when the ``random``
259259
route is matched::
260260

261-
// src/Acme/WebsiteBundle/Controller/RandomController.php
262-
namespace Acme\WebsiteBundle\Controller;
261+
// src/Acme/DemoBundle/Controller/RandomController.php
262+
namespace Acme\DemoBundle\Controller;
263263

264264
use Symfony\Component\HttpFoundation\Response;
265265

@@ -319,8 +319,8 @@ of writing the HTML inside the controller, render a template instead:
319319
.. code-block:: php
320320
:linenos:
321321
322-
// src/Acme/WebsiteBundle/Controller/RandomController.php
323-
namespace Acme\WebsiteBundle\Controller;
322+
// src/Acme/DemoBundle/Controller/RandomController.php
323+
namespace Acme\DemoBundle\Controller;
324324
325325
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
326326
@@ -331,13 +331,13 @@ of writing the HTML inside the controller, render a template instead:
331331
$number = rand(1, $limit);
332332
333333
return $this->render(
334-
'AcmeWebsiteBundle:Random:index.html.twig',
334+
'AcmeDemoBundle:Random:index.html.twig',
335335
array('number' => $number)
336336
);
337337
338338
// render a PHP template instead
339339
// return $this->render(
340-
// 'AcmeWebsiteBundle:Random:index.html.php',
340+
// 'AcmeDemoBundle:Random:index.html.php',
341341
// array('number' => $number)
342342
// );
343343
}
@@ -361,7 +361,7 @@ By default, Symfony2 supports two different templating languages: classic
361361
PHP templates and the succinct but powerful `Twig`_ templates. Don't be
362362
alarmed - you're free to choose either or even both in the same project.
363363

364-
The controller renders the ``AcmeWebsiteBundle:Random:index.html.twig`` template,
364+
The controller renders the ``AcmeDemoBundle:Random:index.html.twig`` template,
365365
which uses the following naming convention:
366366

367367
**BundleName**:**ControllerName**:**TemplateName**
@@ -371,15 +371,15 @@ location using the following convention.
371371

372372
**/path/to/BundleName**/Resources/views/**ControllerName**/**TemplateName**
373373

374-
In this case, ``AcmeWebsiteBundle`` is the bundle name, ``Random`` is the
374+
In this case, ``AcmeDemoBundle`` is the bundle name, ``Random`` is the
375375
controller, and ``index.html.twig`` the template:
376376

377377
.. configuration-block::
378378

379379
.. code-block:: jinja
380380
:linenos:
381381
382-
{# src/Acme/WebsiteBundle/Resources/views/Random/index.html.twig #}
382+
{# src/Acme/DemoBundle/Resources/views/Random/index.html.twig #}
383383
{% extends '::base.html.twig' %}
384384
385385
{% block body %}
@@ -388,7 +388,7 @@ controller, and ``index.html.twig`` the template:
388388
389389
.. code-block:: html+php
390390

391-
<!-- src/Acme/WebsiteBundle/Resources/views/Random/index.html.php -->
391+
<!-- src/Acme/DemoBundle/Resources/views/Random/index.html.php -->
392392
<?php $view->extend('::base.html.php') ?>
393393

394394
Number: <?php echo $view->escape($number) ?>
@@ -573,9 +573,9 @@ You'll learn more about each of these directories in later chapters.
573573
.. code-block:: text
574574
575575
Class Name:
576-
Acme\WebsiteBundle\Controller\RandomController
576+
Acme\DemoBundle\Controller\RandomController
577577
Path:
578-
src/Acme/WebsiteBundle/Controller/RandomController.php
578+
src/Acme/DemoBundle/Controller/RandomController.php
579579
580580
The Source (``src``) Directory
581581
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -725,7 +725,7 @@ Bundle Directory Structure
725725

726726
The directory structure of a bundle is simple and flexible. By default, the
727727
bundle system follows a set of conventions that help to keep code consistent
728-
between all Symfony2 bundles. Take a look at ``AcmeWebsiteBundle``, as it contains
728+
between all Symfony2 bundles. Take a look at ``AcmeDemoBundle``, as it contains
729729
some of the most common elements of a bundle:
730730

731731
* ``Controller/`` contains the controllers of the bundle (e.g. ``RandomController.php``);

0 commit comments

Comments
 (0)
0