Skip to content

Commit dadf808

Browse files
committed
Merge branch '2.0'
Conflicts: book/installation.rst book/propel.rst cookbook/doctrine/index.rst cookbook/map.rst.inc quick_tour/the_big_picture.rst
2 parents 60e3e3c + 0a23fb7 commit dadf808

39 files changed

+450
-92
lines changed

book/controller.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ command:
553553

554554
.. code-block:: bash
555555
556-
php app/console container:debug
556+
$ php app/console container:debug
557557
558558
For more information, see the :doc:`/book/service_container` chapter.
559559

book/doctrine.rst

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ persist it to the database and fetch it back out.
3737

3838
.. code-block:: bash
3939
40-
php app/console generate:bundle --namespace=Acme/StoreBundle
40+
$ php app/console generate:bundle --namespace=Acme/StoreBundle
4141
4242
Configuring the Database
4343
~~~~~~~~~~~~~~~~~~~~~~~~
@@ -79,12 +79,38 @@ information. By convention, this information is usually configured in an
7979
of your project, like inside your Apache configuration, for example. For
8080
more information, see :doc:`/cookbook/configuration/external_parameters`.
8181

82+
.. sidebar:: Setting Up The Database
83+
84+
One mistake even seasoned developers make when starting a Symfony2 project
85+
is forgetting to setup default charset and collation on their database,
86+
ending up with latin type collations, which are default for most databases.
87+
They might even remember to do it the very first time, but forget that
88+
it's all gone after running a relatively common command during development:
89+
90+
.. code-block:: bash
91+
92+
$ app/console doctrine:database:drop --force
93+
$ app/console doctrine:database:create
94+
95+
There's no way to configure these defaults inside Doctrine, as it tries to be
96+
as agnostic as possible in terms of environment configuration. One way to solve
97+
this problem is to configure server-level defaults.
98+
99+
Setting UTF8 defaults for MySQL is as simple as adding a few lines to
100+
your configuration file (typically ``my.cnf``):
101+
102+
.. code-block:: ini
103+
104+
[mysqld]
105+
collation-server = utf8_general_ci
106+
character-set-server = utf8
107+
82108
Now that Doctrine knows about your database, you can have it create the database
83109
for you:
84110

85111
.. code-block:: bash
86112
87-
php app/console doctrine:database:create
113+
$ php app/console doctrine:database:create
88114
89115
Creating an Entity Class
90116
~~~~~~~~~~~~~~~~~~~~~~~~
@@ -118,7 +144,7 @@ just a simple PHP class.
118144

119145
.. code-block:: bash
120146
121-
php app/console doctrine:generate:entity --entity="AcmeStoreBundle:Product" --fields="name:string(255) price:float description:text"
147+
$ php app/console doctrine:generate:entity --entity="AcmeStoreBundle:Product" --fields="name:string(255) price:float description:text"
122148
123149
.. index::
124150
single: Doctrine; Adding mapping metadata
@@ -279,7 +305,7 @@ a regular PHP class, you need to create getter and setter methods (e.g. ``getNam
279305

280306
.. code-block:: bash
281307
282-
php app/console doctrine:generate:entities Acme/StoreBundle/Entity/Product
308+
$ php app/console doctrine:generate:entities Acme/StoreBundle/Entity/Product
283309
284310
This command makes sure that all of the getters and setters are generated
285311
for the ``Product`` class. This is a safe command - you can run it over and
@@ -313,8 +339,8 @@ mapping information) of a bundle or an entire namespace:
313339

314340
.. code-block:: bash
315341
316-
php app/console doctrine:generate:entities AcmeStoreBundle
317-
php app/console doctrine:generate:entities Acme
342+
$ php app/console doctrine:generate:entities AcmeStoreBundle
343+
$ php app/console doctrine:generate:entities Acme
318344
319345
.. note::
320346

@@ -334,7 +360,7 @@ in your application. To do this, run:
334360

335361
.. code-block:: bash
336362
337-
php app/console doctrine:schema:update --force
363+
$ php app/console doctrine:schema:update --force
338364
339365
.. tip::
340366

@@ -727,7 +753,7 @@ used earlier to generate the missing getter and setter methods:
727753

728754
.. code-block:: bash
729755
730-
php app/console doctrine:generate:entities Acme
756+
$ php app/console doctrine:generate:entities Acme
731757
732758
Next, add a new method - ``findAllOrderedByName()`` - to the newly generated
733759
repository class. This method will query for all of the ``Product`` entities,
@@ -779,7 +805,7 @@ you can let Doctrine create the class for you.
779805

780806
.. code-block:: bash
781807
782-
php app/console doctrine:generate:entity --entity="AcmeStoreBundle:Category" --fields="name:string(255)"
808+
$ php app/console doctrine:generate:entity --entity="AcmeStoreBundle:Category" --fields="name:string(255)"
783809
784810
This task generates the ``Category`` entity for you, with an ``id`` field,
785811
a ``name`` field and the associated getter and setter functions.
@@ -890,7 +916,7 @@ methods for you:
890916

891917
.. code-block:: bash
892918
893-
php app/console doctrine:generate:entities Acme
919+
$ php app/console doctrine:generate:entities Acme
894920
895921
Ignore the Doctrine metadata for a moment. You now have two classes - ``Category``
896922
and ``Product`` with a natural one-to-many relationship. The ``Category``
@@ -919,7 +945,7 @@ table, and ``product.category_id`` column, and new foreign key:
919945

920946
.. code-block:: bash
921947
922-
php app/console doctrine:schema:update --force
948+
$ php app/console doctrine:schema:update --force
923949
924950
.. note::
925951

@@ -1322,7 +1348,7 @@ without any arguments:
13221348

13231349
.. code-block:: bash
13241350
1325-
php app/console
1351+
$ php app/console
13261352
13271353
A list of available command will print out, many of which start with the
13281354
``doctrine:`` prefix. You can find out more information about any of these
@@ -1331,7 +1357,7 @@ to get details about the ``doctrine:database:create`` task, run:
13311357

13321358
.. code-block:: bash
13331359
1334-
php app/console help doctrine:database:create
1360+
$ php app/console help doctrine:database:create
13351361
13361362
Some notable or interesting tasks include:
13371363

@@ -1341,7 +1367,7 @@ Some notable or interesting tasks include:
13411367

13421368
.. code-block:: bash
13431369
1344-
php app/console doctrine:ensure-production-settings --env=prod
1370+
$ php app/console doctrine:ensure-production-settings --env=prod
13451371
13461372
* ``doctrine:mapping:import`` - allows Doctrine to introspect an existing
13471373
database and create mapping information. For more information, see

book/forms.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ going to need to build a form. But before you begin, first focus on the generic
6464

6565
.. code-block:: bash
6666
67-
php app/console generate:bundle --namespace=Acme/TaskBundle
67+
$ php app/console generate:bundle --namespace=Acme/TaskBundle
6868
6969
This class is a "plain-old-PHP-object" because, so far, it has nothing
7070
to do with Symfony or any other library. It's quite simply a normal PHP object

book/http_fundamentals.rst

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -483,25 +483,28 @@ libraries that can be used inside *any* PHP project. These libraries, called
483483
the *Symfony2 Components*, contain something useful for almost any situation,
484484
regardless of how your project is developed. To name a few:
485485

486-
* `HttpFoundation`_ - Contains the ``Request`` and ``Response`` classes, as
487-
well as other classes for handling sessions and file uploads;
486+
* :doc:`HttpFoundation</components/http_foundation/introduction>` - Contains
487+
the ``Request`` and ``Response`` classes, as well as other classes for handling
488+
sessions and file uploads;
488489

489-
* `Routing`_ - Powerful and fast routing system that allows you to map a
490-
specific URI (e.g. ``/contact``) to some information about how that request
491-
should be handled (e.g. execute the ``contactAction()`` method);
490+
* :doc:`Routing</components/routing>` - Powerful and fast routing system that
491+
allows you to map a specific URI (e.g. ``/contact``) to some information
492+
about how that request should be handled (e.g. execute the ``contactAction()``
493+
method);
492494

493495
* `Form`_ - A full-featured and flexible framework for creating forms and
494496
handling form submissions;
495497

496498
* `Validator`_ A system for creating rules about data and then validating
497499
whether or not user-submitted data follows those rules;
498500

499-
* `ClassLoader`_ An autoloading library that allows PHP classes to be used
500-
without needing to manually ``require`` the files containing those classes;
501+
* :doc:`ClassLoader</components/class_loader>` An autoloading library that allows
502+
PHP classes to be used without needing to manually ``require`` the files
503+
containing those classes;
501504

502-
* `Templating`_ A toolkit for rendering templates, handling template inheritance
503-
(i.e. a template is decorated with a layout) and performing other common
504-
template tasks;
505+
* :doc:`Templating</components/templating>` A toolkit for rendering templates,
506+
handling template inheritance (i.e. a template is decorated with a layout)
507+
and performing other common template tasks;
505508

506509
* `Security`_ - A powerful library for handling all types of security inside
507510
an application;
@@ -541,11 +544,7 @@ sensible defaults. For more advanced users, the sky is the limit.
541544
.. _`List of HTTP status codes`: http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
542545
.. _`List of HTTP header fields`: http://en.wikipedia.org/wiki/List_of_HTTP_header_fields
543546
.. _`List of common media types`: http://en.wikipedia.org/wiki/Internet_media_type#List_of_common_media_types
544-
.. _`HttpFoundation`: https://github.com/symfony/HttpFoundation
545-
.. _`Routing`: https://github.com/symfony/Routing
546547
.. _`Form`: https://github.com/symfony/Form
547548
.. _`Validator`: https://github.com/symfony/Validator
548-
.. _`ClassLoader`: https://github.com/symfony/ClassLoader
549-
.. _`Templating`: https://github.com/symfony/Templating
550549
.. _`Security`: https://github.com/symfony/Security
551550
.. _`Translation`: https://github.com/symfony/Translation

book/installation.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ one of the following commands (replacing ``###`` with your actual filename):
5252
.. code-block:: bash
5353
5454
# for .tgz file
55-
tar zxvf Symfony_Standard_Vendors_2.0.###.tgz
55+
$ tar zxvf Symfony_Standard_Vendors_2.0.###.tgz
5656
5757
# for a .zip file
58-
unzip Symfony_Standard_Vendors_2.0.###.zip
58+
$ unzip Symfony_Standard_Vendors_2.0.###.zip
5959
6060
When you're finished, you should have a ``Symfony/`` directory that looks
6161
something like this:
@@ -95,7 +95,7 @@ Step 2: Install vendors
9595

9696
.. code-block:: bash
9797
98-
php composer.phar install
98+
$ php composer.phar install
9999
100100
This command downloads all of the necessary vendor libraries - including
101101
Symfony itself - into the ``vendor/`` directory.
@@ -163,11 +163,11 @@ If there are any issues, correct them now before moving on.
163163

164164
.. code-block:: bash
165165
166-
rm -rf app/cache/*
167-
rm -rf app/logs/*
166+
$ rm -rf app/cache/*
167+
$ rm -rf app/logs/*
168168
169-
sudo chmod +a "www-data allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
170-
sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
169+
$ sudo chmod +a "www-data allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
170+
$ sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
171171
172172
**2. Using Acl on a system that does not support chmod +a**
173173

@@ -178,8 +178,8 @@ If there are any issues, correct them now before moving on.
178178

179179
.. code-block:: bash
180180
181-
sudo setfacl -R -m u:www-data:rwx -m u:`whoami`:rwx app/cache app/logs
182-
sudo setfacl -dR -m u:www-data:rwx -m u:`whoami`:rwx app/cache app/logs
181+
$ sudo setfacl -R -m u:www-data:rwx -m u:`whoami`:rwx app/cache app/logs
182+
$ sudo setfacl -dR -m u:www-data:rwx -m u:`whoami`:rwx app/cache app/logs
183183
184184
Note that not all web servers run as the user ``www-data``. You have to
185185
check which user the web server is being run as and put it in for ``www-data``.

book/page_creation.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ instructions (use all of the default options):
6969

7070
.. code-block:: bash
7171
72-
php app/console generate:bundle --namespace=Acme/HelloBundle --format=yml
72+
$ php app/console generate:bundle --namespace=Acme/HelloBundle --format=yml
7373
7474
Behind the scenes, a directory is created for the bundle at ``src/Acme/HelloBundle``.
7575
A line is also automatically added to the ``app/AppKernel.php`` file so that
@@ -261,7 +261,7 @@ application should greet you:
261261

262262
.. code-block:: bash
263263
264-
php app/console cache:clear --env=prod --no-debug
264+
$ php app/console cache:clear --env=prod --no-debug
265265
266266
An optional, but common, third step in the process is to create a template.
267267

@@ -667,7 +667,7 @@ generating a basic bundle skeleton:
667667

668668
.. code-block:: bash
669669
670-
php app/console generate:bundle --namespace=Acme/TestBundle
670+
$ php app/console generate:bundle --namespace=Acme/TestBundle
671671
672672
The bundle skeleton generates with a basic controller, template and routing
673673
resource that can be customized. You'll learn more about Symfony2's command-line

book/propel.rst

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ persist it to the database and fetch it back out.
2222

2323
.. code-block:: bash
2424
25-
php app/console generate:bundle --namespace=Acme/StoreBundle
25+
$ php app/console generate:bundle --namespace=Acme/StoreBundle
2626
2727
Configuring the Database
2828
~~~~~~~~~~~~~~~~~~~~~~~~
@@ -62,7 +62,7 @@ you:
6262

6363
.. code-block:: bash
6464
65-
php app/console propel:database:create
65+
$ php app/console propel:database:create
6666
6767
.. note::
6868

@@ -104,7 +104,7 @@ After creating your ``schema.xml``, generate your model from it by running:
104104

105105
.. code-block:: bash
106106
107-
php app/console propel:model:build
107+
$ php app/console propel:model:build
108108
109109
This generates each model class to quickly develop your application in the
110110
``Model/`` directory the ``AcmeStoreBundle`` bundle.
@@ -119,9 +119,8 @@ needed for every known model in your application. To do this, run:
119119

120120
.. code-block:: bash
121121
122-
php app/console propel:sql:build
123-
124-
php app/console propel:sql:insert --force
122+
$ php app/console propel:sql:build
123+
$ php app/console propel:sql:insert --force
125124
126125
Your database now has a fully-functional ``product`` table with columns that
127126
match the schema you've specified.
@@ -305,17 +304,16 @@ Create the classes:
305304

306305
.. code-block:: bash
307306
308-
php app/console propel:model:build
307+
$ php app/console propel:model:build
309308
310309
Assuming you have products in your database, you don't want lose them. Thanks to
311310
migrations, Propel will be able to update your database without losing existing
312311
data.
313312

314313
.. code-block:: bash
315314
316-
php app/console propel:migration:generate-diff
317-
318-
php app/console propel:migration:migrate
315+
$ php app/console propel:migration:generate-diff
316+
$ php app/console propel:migration:migrate
319317
320318
Your database has been updated, you can continue to write your application.
321319

book/routing.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,7 @@ the command by running the following from the root of your project.
10351035

10361036
.. code-block:: bash
10371037
1038-
php app/console router:debug
1038+
$ php app/console router:debug
10391039
10401040
The command will print a helpful list of *all* the configured routes in
10411041
your application:
@@ -1054,7 +1054,7 @@ the route name after the command:
10541054

10551055
.. code-block:: bash
10561056
1057-
php app/console router:debug article_show
1057+
$ php app/console router:debug article_show
10581058
10591059
.. index::
10601060
single: Routing; Generating URLs

book/translation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ filesystem and discovered by Symfony, thanks to some conventions.
273273

274274
.. code-block:: bash
275275
276-
php app/console cache:clear
276+
$ php app/console cache:clear
277277
278278
.. index::
279279
single: Translations; Translation resource locations

components/class_loader.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.. index::
22
pair: Autoloader; Configuration
3+
single: Components; ClassLoader
34

45
The ClassLoader Component
56
=========================

components/config/introduction.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.. index::
22
single: Config
3+
single: Components; Config
34

45
The Config Component
56
====================

0 commit comments

Comments
 (0)