Skip to content

Navigation Menu

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 16055f7

Browse filesBrowse 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
Copy full SHA for 16055f7
Expand file treeCollapse file tree

33 files changed

+926
-1263
lines changed

‎_build/redirection_map

Copy file name to clipboardExpand all lines: _build/redirection_map
+2Lines 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

Copy file name to clipboard
141 KB
Loading

‎_images/quick_tour/profiler.png

Copy file name to clipboard
-73.6 KB
Binary file not shown.
20.2 KB
Loading

‎_images/quick_tour/welcome.png

Copy file name to clipboard
-48.6 KB
Binary file not shown.

‎bundles.rst

Copy file name to clipboardExpand all lines: bundles.rst
+115-3Lines 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

Copy file name to clipboardExpand all lines: bundles/best_practices.rst
+2-2Lines 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

Copy file name to clipboardExpand all lines: components/asset.rst
+2-2Lines 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

Copy file name to clipboardExpand all lines: components/event_dispatcher.rst
+6-6Lines 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

Copy file name to clipboardExpand all lines: components/finder.rst
+2-2Lines 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
------------

‎components/process.rst

Copy file name to clipboardExpand all lines: components/process.rst
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -328,12 +328,12 @@ Process Idle Timeout
328328
In contrast to the timeout of the previous paragraph, the idle timeout only
329329
considers the time since the last output was produced by the process::
330330

331-
use Symfony\Component\Process\Process;
331+
use Symfony\Component\Process\Process;
332332

333-
$process = new Process('something-with-variable-runtime');
334-
$process->setTimeout(3600);
335-
$process->setIdleTimeout(60);
336-
$process->run();
333+
$process = new Process('something-with-variable-runtime');
334+
$process->setTimeout(3600);
335+
$process->setIdleTimeout(60);
336+
$process->run();
337337

338338
In the case above, a process is considered timed out, when either the total runtime
339339
exceeds 3600 seconds, or the process does not produce any output for 60 seconds.

‎components/routing.rst

Copy file name to clipboardExpand all lines: components/routing.rst
+24-24Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
The Routing Component
66
=====================
77

8-
The Routing component maps an HTTP request to a set of configuration
9-
variables.
8+
The Routing component maps an HTTP request to a set of configuration
9+
variables.
1010

1111
Installation
1212
------------
@@ -100,28 +100,28 @@ A full route definition can contain up to seven parts:
100100

101101
Take the following route, which combines several of these ideas::
102102

103-
$route = new Route(
104-
'/archive/{month}', // path
105-
array('_controller' => 'showArchive'), // default values
106-
array('month' => '[0-9]{4}-[0-9]{2}', 'subdomain' => 'www|m'), // requirements
107-
array(), // options
108-
'{subdomain}.example.com', // host
109-
array(), // schemes
110-
array() // methods
111-
);
112-
113-
// ...
114-
115-
$parameters = $matcher->match('/archive/2012-01');
116-
// array(
117-
// '_controller' => 'showArchive',
118-
// 'month' => '2012-01',
119-
// 'subdomain' => 'www',
120-
// '_route' => ...
121-
// )
122-
123-
$parameters = $matcher->match('/archive/foo');
124-
// throws ResourceNotFoundException
103+
$route = new Route(
104+
'/archive/{month}', // path
105+
array('_controller' => 'showArchive'), // default values
106+
array('month' => '[0-9]{4}-[0-9]{2}', 'subdomain' => 'www|m'), // requirements
107+
array(), // options
108+
'{subdomain}.example.com', // host
109+
array(), // schemes
110+
array() // methods
111+
);
112+
113+
// ...
114+
115+
$parameters = $matcher->match('/archive/2012-01');
116+
// array(
117+
// '_controller' => 'showArchive',
118+
// 'month' => '2012-01',
119+
// 'subdomain' => 'www',
120+
// '_route' => ...
121+
// )
122+
123+
$parameters = $matcher->match('/archive/foo');
124+
// throws ResourceNotFoundException
125125

126126
In this case, the route is matched by ``/archive/2012-01``, because the ``{month}``
127127
wildcard matches the regular expression wildcard given. However, ``/archive/foo``

‎components/serializer.rst

Copy file name to clipboardExpand all lines: components/serializer.rst
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
The Serializer Component
66
========================
77

8-
The Serializer component is meant to be used to turn objects into a
9-
specific format (XML, JSON, YAML, ...) and the other way around.
8+
The Serializer component is meant to be used to turn objects into a
9+
specific format (XML, JSON, YAML, ...) and the other way around.
1010

1111
In order to do so, the Serializer component follows the following
1212
simple schema.

‎configuration/environments.rst

Copy file name to clipboardExpand all lines: configuration/environments.rst
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ your application in the configured environment.
100100

101101
.. note::
102102

103-
The given URLs assume that your web server is configured to use the ``public/``
104-
directory of the application as its root. Read more in :doc:`Installing Symfony </setup>`.
103+
The given URLs assume that your web server is configured to use the ``public/``
104+
directory of the application as its root. Read more in :doc:`Installing Symfony </setup>`.
105105

106106
If you open the file you just visited (``public/index.php``), you'll see that
107107
the environment variable is passed to the kernel::
@@ -119,8 +119,8 @@ always run the application in the dev environment, independent of the
119119

120120
.. note::
121121

122-
The ``test`` environment is used when writing functional tests and is
123-
usually not accessed in the browser directly via a front controller.
122+
The ``test`` environment is used when writing functional tests and is
123+
usually not accessed in the browser directly via a front controller.
124124

125125
.. index::
126126
single: Configuration; Debug mode

‎contributing/code/patches.rst

Copy file name to clipboardExpand all lines: contributing/code/patches.rst
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ software:
1818

1919
.. caution::
2020

21-
Before Symfony 2.7, the minimal PHP version was 5.3.3. Before Symfony 3.0,
22-
minimal version was 5.3.9. Please keep this in mind, if you are working on a
23-
bug fix for earlier versions of Symfony.
21+
Before Symfony 2.7, the minimal PHP version was 5.3.3. Before Symfony 3.0,
22+
minimal version was 5.3.9. Please keep this in mind, if you are working on a
23+
bug fix for earlier versions of Symfony.
2424

2525
Configure Git
2626
~~~~~~~~~~~~~

‎doctrine/registration_form.rst

Copy file name to clipboardExpand all lines: doctrine/registration_form.rst
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,8 @@ your database schema using this command:
335335

336336
.. code-block:: terminal
337337
338-
$ php bin/console doctrine:migrations:diff
339-
$ php bin/console doctrine:migrations:migrate
338+
$ php bin/console doctrine:migrations:diff
339+
$ php bin/console doctrine:migrations:migrate
340340
341341
That's it! Head to ``/register`` to try things out!
342342

‎form/form_customization.rst

Copy file name to clipboardExpand all lines: form/form_customization.rst
+13-12Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -760,14 +760,14 @@ field whose *id* is ``product_name`` (and name is ``product[name]``).
760760

761761
.. tip::
762762

763-
The ``product`` portion of the field is the form name, which may be set
764-
manually or generated automatically based on your form type name (e.g.
765-
``ProductType`` equates to ``product``). If you're not sure what your
766-
form name is, just view the source of your generated form.
763+
The ``product`` portion of the field is the form name, which may be set
764+
manually or generated automatically based on your form type name (e.g.
765+
``ProductType`` equates to ``product``). If you're not sure what your
766+
form name is, just view the source of your generated form.
767767

768-
If you want to change the ``product`` or ``name`` portion of the block
769-
name ``_product_name_widget`` you can set the ``block_name`` option in your
770-
form type::
768+
If you want to change the ``product`` or ``name`` portion of the block
769+
name ``_product_name_widget`` you can set the ``block_name`` option in your
770+
form type::
771771

772772
use Symfony\Component\Form\FormBuilderInterface;
773773
use Symfony\Component\Form\Extension\Core\Type\TextType;
@@ -781,7 +781,7 @@ field whose *id* is ``product_name`` (and name is ``product[name]``).
781781
));
782782
}
783783

784-
Then the block name will be ``_product_custom_name_widget``.
784+
Then the block name will be ``_product_custom_name_widget``.
785785

786786
You can also override the markup for an entire field row using the same method:
787787

@@ -874,10 +874,11 @@ Customizing Error Output
874874
~~~~~~~~~~~~~~~~~~~~~~~~
875875

876876
.. note::
877-
The Form component only handles *how* the validation errors are rendered,
878-
and not the actual validation error messages. The error messages themselves
879-
are determined by the validation constraints you apply to your objects.
880-
For more information, see the article on :doc:`validation </validation>`.
877+
878+
The Form component only handles *how* the validation errors are rendered,
879+
and not the actual validation error messages. The error messages themselves
880+
are determined by the validation constraints you apply to your objects.
881+
For more information, see the article on :doc:`validation </validation>`.
881882

882883
There are many different ways to customize how errors are rendered when a
883884
form is submitted with errors. The error messages for a field are rendered

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.