Skip to content

Commit 16055f7

Browse files
committed
Merge branch '4.0'
* 4.0: fixing code block type and adding missing link tweaks thanks to Javier Comments thanks to Javier and fixing build issues Fixed indentation errors adding progress WIP - 2/3 parts of the quick tour finished
2 parents 0ba3d9f + 548360a commit 16055f7

33 files changed

+926
-1263
lines changed

_build/redirection_map

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,3 +381,5 @@
381381
/testing/simulating_authentication /testing/http_authentication
382382
/validation/group_service_resolver /form/validation_group_service_resolver
383383
/request/load_balancer_reverse_proxy /deployment/proxies
384+
/quick_tour/the_controller /quick_tour/the_big_picture
385+
/quick_tour/the_view /quick_tour/flex_recipes

_images/quick_tour/no_routes_page.png

141 KB
Loading

_images/quick_tour/profiler.png

-73.6 KB
Binary file not shown.
20.2 KB
Loading

_images/quick_tour/welcome.png

-48.6 KB
Binary file not shown.

bundles.rst

Lines changed: 115 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,121 @@ file::
3737

3838
.. tip::
3939

40-
In a default Symfony application that uses :doc:`Symfony Flex </setup/flex>`,
41-
bundles are enabled/disabled automatically for you when installing/removing
42-
them, so you don't need to look at or edit this ``bundles.php`` file.
40+
In a default Symfony application that uses :doc:`Symfony Flex </setup/flex>`,
41+
bundles are enabled/disabled automatically for you when installing/removing
42+
them, so you don't need to look at or edit this ``bundles.php`` file.
43+
44+
Creating a Bundle
45+
-----------------
46+
47+
The Symfony Standard Edition comes with a handy task that creates a fully-functional
48+
bundle for you. Of course, creating a bundle by hand is pretty easy as well.
49+
50+
To show you how simple the bundle system is, create a new bundle called
51+
AcmeTestBundle and enable it.
52+
53+
.. tip::
54+
55+
The ``Acme`` portion is just a dummy name that should be replaced by
56+
some "vendor" name that represents you or your organization (e.g.
57+
ABCTestBundle for some company named ``ABC``).
58+
59+
Start by creating a ``src/Acme/TestBundle/`` directory and adding a new file
60+
called ``AcmeTestBundle.php``::
61+
62+
// src/Acme/TestBundle/AcmeTestBundle.php
63+
namespace Acme\TestBundle;
64+
65+
use Symfony\Component\HttpKernel\Bundle\Bundle;
66+
67+
class AcmeTestBundle extends Bundle
68+
{
69+
}
70+
71+
.. tip::
72+
73+
The name AcmeTestBundle follows the standard
74+
:ref:`Bundle naming conventions <bundles-naming-conventions>`. You could
75+
also choose to shorten the name of the bundle to simply TestBundle by naming
76+
this class TestBundle (and naming the file ``TestBundle.php``).
77+
78+
This empty class is the only piece you need to create the new bundle. Though
79+
commonly empty, this class is powerful and can be used to customize the behavior
80+
of the bundle.
81+
82+
Now that you've created the bundle, enable it via the ``AppKernel`` class::
83+
84+
// app/AppKernel.php
85+
public function registerBundles()
86+
{
87+
$bundles = array(
88+
// ...
89+
90+
// register your bundle
91+
new Acme\TestBundle\AcmeTestBundle(),
92+
);
93+
// ...
94+
95+
return $bundles;
96+
}
97+
98+
And while it doesn't do anything yet, AcmeTestBundle is now ready to be used.
99+
100+
And as easy as this is, Symfony also provides a command-line interface for
101+
generating a basic bundle skeleton:
102+
103+
.. code-block:: terminal
104+
105+
$ php bin/console generate:bundle --namespace=Acme/TestBundle
106+
107+
The bundle skeleton generates a basic controller, template and routing
108+
resource that can be customized. You'll learn more about Symfony's command-line
109+
tools later.
110+
111+
.. tip::
112+
113+
Whenever creating a new bundle or using a third-party bundle, always make
114+
sure the bundle has been enabled in ``registerBundles()``. When using
115+
the ``generate:bundle`` command, this is done for you.
116+
117+
Bundle Directory Structure
118+
--------------------------
119+
120+
The directory structure of a bundle is simple and flexible. By default, the
121+
bundle system follows a set of conventions that help to keep code consistent
122+
between all Symfony bundles. Take a look at AcmeDemoBundle, as it contains some
123+
of the most common elements of a bundle:
124+
125+
``Controller/``
126+
Contains the controllers of the bundle (e.g. ``RandomController.php``).
127+
128+
``DependencyInjection/``
129+
Holds certain Dependency Injection Extension classes, which may import service
130+
configuration, register compiler passes or more (this directory is not
131+
necessary).
132+
133+
``Resources/config/``
134+
Houses configuration, including routing configuration (e.g. ``routing.yml``).
135+
136+
``Resources/views/``
137+
Holds templates organized by controller name (e.g. ``Random/index.html.twig``).
138+
139+
``Resources/public/``
140+
Contains web assets (images, stylesheets, etc) and is copied or symbolically
141+
linked into the project ``web/`` directory via the ``assets:install`` console
142+
command.
143+
144+
``Tests/``
145+
Holds all tests for the bundle.
146+
147+
A bundle can be as small or large as the feature it implements. It contains
148+
only the files you need and nothing else.
149+
150+
As you move through the guides, you'll learn how to persist objects to a
151+
database, create and validate forms, create translations for your application,
152+
write tests and much more. Each of these has their own place and role within
153+
the bundle.
154+
>>>>>>> 3.4
43155

44156
Learn more
45157
----------

bundles/best_practices.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ the ``Tests/`` directory. Tests should follow the following principles:
163163

164164
.. note::
165165

166-
A test suite must not contain ``AllTests.php`` scripts, but must rely on the
167-
existence of a ``phpunit.xml.dist`` file.
166+
A test suite must not contain ``AllTests.php`` scripts, but must rely on the
167+
existence of a ``phpunit.xml.dist`` file.
168168

169169
Installation
170170
------------

components/asset.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
The Asset Component
66
===================
77

8-
The Asset component manages URL generation and versioning of web assets such
9-
as CSS stylesheets, JavaScript files and image files.
8+
The Asset component manages URL generation and versioning of web assets such
9+
as CSS stylesheets, JavaScript files and image files.
1010

1111
In the past, it was common for web applications to hardcode URLs of web assets.
1212
For example:

components/event_dispatcher.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -402,14 +402,14 @@ the dispatcher to stop all propagation of the event to future listeners
402402
inside a listener via the
403403
:method:`Symfony\\Component\\EventDispatcher\\Event::stopPropagation` method::
404404

405-
use Acme\Store\Event\OrderPlacedEvent;
405+
use Acme\Store\Event\OrderPlacedEvent;
406406

407-
public function onStoreOrder(OrderPlacedEvent $event)
408-
{
409-
// ...
407+
public function onStoreOrder(OrderPlacedEvent $event)
408+
{
409+
// ...
410410

411-
$event->stopPropagation();
412-
}
411+
$event->stopPropagation();
412+
}
413413

414414
Now, any listeners to ``order.placed`` that have not yet been called will
415415
*not* be called.

components/finder.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
The Finder Component
66
====================
77

8-
The Finder component finds files and directories via an intuitive fluent
9-
interface.
8+
The Finder component finds files and directories via an intuitive fluent
9+
interface.
1010

1111
Installation
1212
------------

0 commit comments

Comments
 (0)