Skip to content

Commit 1df50db

Browse files
committed
Merge branch '2.0' into 2.1
Conflicts: reference/configuration/assetic.rst reference/configuration/web_profiler.rst
2 parents 0ad5cf4 + cf850b8 commit 1df50db

File tree

13 files changed

+211
-18
lines changed

13 files changed

+211
-18
lines changed

book/doctrine.rst

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ for you:
8888
8989
$ php app/console doctrine:database:create
9090
91-
.. sidebar:: Setting Up The Database
91+
.. sidebar:: Setting Up The Database to be UTF8
9292

9393
One mistake even seasoned developers make when starting a Symfony2 project
9494
is forgetting to setup default charset and collation on their database,
@@ -113,6 +113,45 @@ for you:
113113
[mysqld]
114114
collation-server = utf8_general_ci
115115
character-set-server = utf8
116+
117+
Using SQLite
118+
~~~~~~~~~~~~
119+
120+
If you want to use SQLite as your database, you need to set the path
121+
where your database file should be stored:
122+
123+
.. configuration-block::
124+
125+
.. code-block:: yaml
126+
127+
# app/config/config.yml
128+
doctrine:
129+
dbal:
130+
driver: pdo_sqlite
131+
path: "%kernel.root_dir%/sqlite.db"
132+
charset: UTF8
133+
134+
.. code-block:: xml
135+
136+
<!-- app/config/config.xml -->
137+
<doctrine:config
138+
driver="pdo_sqlite"
139+
path="%kernel.root_dir%/sqlite.db"
140+
charset="UTF-8"
141+
>
142+
<!-- ... -->
143+
</doctrine:config>
144+
145+
.. code-block:: php
146+
147+
// app/config/config.php
148+
$container->loadFromExtension('doctrine', array(
149+
'dbal' => array(
150+
'driver' => 'pdo_sqlite',
151+
'path' => '%kernel.root_dir%/sqlite.db',
152+
'charset' => 'UTF-8',
153+
),
154+
));
116155
117156
Creating an Entity Class
118157
~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1370,7 +1409,7 @@ without any arguments:
13701409
13711410
$ php app/console
13721411
1373-
A list of available command will print out, many of which start with the
1412+
A list of available commands will print out, many of which start with the
13741413
``doctrine:`` prefix. You can find out more information about any of these
13751414
commands (or any Symfony command) by running the ``help`` command. For example,
13761415
to get details about the ``doctrine:database:create`` task, run:

book/page_creation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ options of each feature.
803803
disadvantages. The choice of which to use is up to you:
804804

805805
* *YAML*: Simple, clean and readable (learn more about yaml in
806-
* ":doc:`/components/yaml/yaml_format`");
806+
":doc:`/components/yaml/yaml_format`");
807807

808808
* *XML*: More powerful than YAML at times and supports IDE autocompletion;
809809

components/config/definition.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
.. index::
2-
single: Config; Define and process configuration values
2+
single: Config; Defining and processing configuration values
33

4-
Define and process configuration values
5-
=======================================
4+
Defining and processing configuration values
5+
============================================
66

7-
Validate configuration values
8-
-----------------------------
7+
Validating configuration values
8+
-------------------------------
99

1010
After loading configuration values from all kinds of resources, the values
1111
and their structure can be validated using the "Definition" part of the Config
@@ -38,8 +38,8 @@ they are when first encountered. Also, some keys are only available when
3838
another key has a specific value (in the sample configuration above: the
3939
``memory`` key only makes sense when the ``driver`` is ``sqlite``).
4040

41-
Define a hierarchy of configuration values using the TreeBuilder
42-
----------------------------------------------------------------
41+
Defining a hierarchy of configuration values using the TreeBuilder
42+
------------------------------------------------------------------
4343

4444
All the rules concerning configuration values can be defined using the
4545
:class:`Symfony\\Component\\Config\\Definition\\Builder\\TreeBuilder`.
@@ -66,8 +66,8 @@ should be returned from a custom ``Configuration`` class which implements the
6666
}
6767
}
6868

69-
Add node definitions to the tree
70-
--------------------------------
69+
Adding node definitions to the tree
70+
-----------------------------------
7171

7272
Variable nodes
7373
~~~~~~~~~~~~~~

components/console/single_command_tool.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.. index::
22
single: Console; Single command application
33

4-
How to build an Application that is a single Command
5-
====================================================
4+
Building a Single Command Application
5+
=====================================
66

77
When building a command line tool, you may not need to provide several commands.
88
In such case, having to pass the command name each time is tedious. Fortunately,

cookbook/assetic/asset_management.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,10 @@ the following change in your ``config_dev.yml`` file:
337337
'use_controller' => false,
338338
));
339339
340+
.. note::
341+
342+
You'll also have to remove the ``_assetic`` route in your ``app/config_dev.yml`` file.
343+
340344
Next, since Symfony is no longer generating these assets for you, you'll
341345
need to dump them manually. To do so, run the following:
342346

cookbook/console/console_command.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ should be used instead of :class:`Symfony\\Component\\Console\\Application`::
112112

113113
To be able to use the fully set up service container for your console tests
114114
you can extend your test from
115-
:class:`Symfony\Bundle\FrameworkBundle\Test\WebTestCase`::
115+
:class:`Symfony\\Bundle\\FrameworkBundle\\Test\\WebTestCase`::
116116

117117
use Symfony\Component\Console\Tester\CommandTester;
118118
use Symfony\Bundle\FrameworkBundle\Console\Application;

cookbook/email/gmail.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,20 @@ In the development configuration file, change the ``transport`` setting to
5151
5252
You're done!
5353

54+
.. tip::
55+
56+
If you are using the Symfony Standard Edition, configure the parameters at ``parameters.yml``:
57+
58+
.. code-block:: yaml
59+
60+
# app/config/parameters.yml
61+
parameters:
62+
...
63+
mailer_transport: gmail
64+
mailer_host: ~
65+
mailer_user: your_gmail_username
66+
mailer_password: your_gmail_password
67+
5468
.. note::
5569

5670
The ``gmail`` transport is simply a shortcut that uses the ``smtp`` transport

reference/configuration/assetic.rst

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,52 @@ Full Default Configuration
5252
functions:
5353
# An array of named functions (e.g. some_function, some_other_function)
5454
some_function: []
55+
56+
.. code-block:: xml
57+
58+
<assetic:config
59+
debug="%kernel.debug%"
60+
use-controller="%kernel.debug%"
61+
read-from="%kernel.root_dir%/../web"
62+
write-to="%assetic.read_from%"
63+
java="/usr/bin/java"
64+
node="/usr/bin/node"
65+
sass="/usr/bin/sass"
66+
>
67+
<!-- Defaults (all currently registered bundles) -->
68+
<assetic:bundle>FrameworkBundle</assetic:bundle>
69+
<assetic:bundle>SecurityBundle</assetic:bundle>
70+
<assetic:bundle>TwigBundle</assetic:bundle>
71+
<assetic:bundle>MonologBundle</assetic:bundle>
72+
<assetic:bundle>SwiftmailerBundle</assetic:bundle>
73+
<assetic:bundle>DoctrineBundle</assetic:bundle>
74+
<assetic:bundle>AsseticBundle</assetic:bundle>
75+
<assetic:bundle>...</assetic:bundle>
76+
77+
<assetic:asset>
78+
<!-- prototype -->
79+
<assetic:name>
80+
<assetic:input />
81+
82+
<assetic:filter />
83+
84+
<assetic:option>
85+
<!-- prototype -->
86+
<assetic:name />
87+
</assetic:option>
88+
</assetic:name>
89+
</assetic:asset>
90+
91+
<assetic:filter>
92+
<!-- prototype -->
93+
<assetic:name />
94+
</assetic:filter>
95+
96+
<assetic:twig>
97+
<assetic:functions>
98+
<!-- prototype -->
99+
<assetic:name />
100+
</assetic:functions>
101+
</assetic:twig>
102+
103+
</assetic:config>

reference/configuration/swiftmailer.rst

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,4 +193,30 @@ Full Default Configuration
193193
sleep: 0
194194
delivery_address: ~
195195
disable_delivery: ~
196-
logging: "%kernel.debug%"
196+
logging: "%kernel.debug%"
197+
198+
.. code-block:: xml
199+
200+
<swiftmailer:config
201+
transport="smtp"
202+
username=""
203+
password=""
204+
host="localhost"
205+
port="false"
206+
encryption=""
207+
auth_mode=""
208+
sender_address=""
209+
delivery_address=""
210+
disable_delivery=""
211+
logging="%kernel.debug%"
212+
>
213+
<swiftmailer:spool
214+
path="%kernel.cache_dir%/swiftmailer/spool"
215+
type="file"
216+
/>
217+
218+
<swiftmailer:antiflood
219+
sleep="0"
220+
threshold="99"
221+
/>
222+
</swiftmailer:config>

reference/configuration/web_profiler.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,14 @@ Full Default Configuration
1919
# display the web debug toolbar at the bottom of pages with a summary of profiler info
2020
toolbar: false
2121
position: bottom
22-
intercept_redirects: false
2322
23+
# gives you the opportunity to look at the collected data before following the redirect
24+
intercept_redirects: false
25+
26+
.. code-block:: xml
27+
28+
<web-profiler:config
29+
toolbar="false"
30+
verbose="true"
31+
intercept_redirects="false"
32+
/>

reference/constraints/File.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ below a certain file size and a valid PDF, add the following:
120120
// src/Acme/BlogBundle/Entity/Author.php
121121
namespace Acme\BlogBundle\Entity;
122122
123+
// ...
123124
use Symfony\Component\Validator\Mapping\ClassMetadata;
124125
use Symfony\Component\Validator\Constraints\File;
125126

reference/constraints/Min.rst

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,42 @@ the following:
4747
class Participant
4848
{
4949
/**
50-
* @Assert\Min(limit = "18", message = "You must be 18 or older to enter")
50+
* @Assert\Min(limit = "18", message = "You must be 18 or older to enter.")
5151
*/
5252
protected $age;
5353
}
5454
55+
.. code-block:: xml
56+
57+
<!-- src/Acme/EventBundle/Resources/config/validation.yml -->
58+
<class name="Acme\EventBundle\Entity\Participant">
59+
<property name="age">
60+
<constraint name="Min">
61+
<option name="limit">18</option>
62+
<option name="message">You must be 18 or older to enter.</option>
63+
</constraint>
64+
</property>
65+
</class>
66+
67+
.. code-block:: php
68+
69+
// src/Acme/EventBundle/Entity/Participant.php
70+
namespace Acme\EventBundle\Entity\Participant;
71+
72+
use Symfony\Component\Validator\Mapping\ClassMetadata;
73+
use Symfony\Component\Validator\Constraints as Assert;
74+
75+
class Participant
76+
{
77+
public static function loadValidatorMetadata(ClassMetadata $metadata)
78+
{
79+
$metadata->addPropertyConstraint('age', new Assert\Min(array(
80+
'limit' => '18',
81+
'message' => 'You must be 18 or older to enter.',
82+
));
83+
}
84+
}
85+
5586
Options
5687
-------
5788

reference/constraints/Regex.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,26 @@ message:
127127
</property>
128128
</class>
129129
130+
.. code-block:: php
131+
132+
// src/Acme/BlogBundle/Entity/Author.php
133+
namespace Acme\BlogBundle\Entity;
134+
135+
use Symfony\Component\Validator\Mapping\ClassMetadata;
136+
use Symfony\Component\Validator\Constraints as Assert;
137+
138+
class Author
139+
{
140+
public static function loadValidatorMetadata(ClassMetadata $metadata)
141+
{
142+
$metadata->addPropertyConstraint('firstName', new Assert\Regex(array(
143+
'pattern' => '/\d/',
144+
'match' => false,
145+
'message' => 'Your name cannot contain a number',
146+
)));
147+
}
148+
}
149+
130150
Options
131151
-------
132152

0 commit comments

Comments
 (0)