Skip to content

Commit bb39863

Browse files
committed
Merge branch '2.4' into 2.5
* 2.4: (38 commits) use relative path to page fix xml to specify a method replaced old way of specifying http method by the new one Fixing a mistake Fix use mistakes. [#3944] Tiny addition to mention multiple connections Update dbal.rst [#3888] Changing base template title back [Components] consistent & complete config examples Check for api_key in request Update api_key_authentication.rst - POST Method Fixed typos Added link to JSFiddle example some minor improvements describe the usage of the RegisterListenersPass Update deployment-tools.rst Rewrote Extension & Configuration docs add order of translation formats Fix class name in ConsoleTerminateListener example Fixed the code snippets for the expression language functions ...
2 parents 5ab5246 + 303ff29 commit bb39863

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1972
-1243
lines changed

book/controller.rst

+12
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,16 @@ to the controller:
170170
.. code-block:: php
171171
172172
// app/config/routing.php
173+
use Symfony\Component\Routing\Route;
174+
use Symfony\Component\Routing\RouteCollection;
175+
176+
$collection = new RouteCollection();
173177
$collection->add('hello', new Route('/hello/{name}', array(
174178
'_controller' => 'AcmeHelloBundle:Hello:index',
175179
)));
176180
181+
return $collection;
182+
177183
Going to ``/hello/ryan`` now executes the ``HelloController::indexAction()``
178184
controller and passes in ``ryan`` for the ``$name`` variable. Creating a
179185
"page" means simply creating a controller method and associated route.
@@ -257,11 +263,17 @@ example:
257263
.. code-block:: php
258264
259265
// app/config/routing.php
266+
use Symfony\Component\Routing\Route;
267+
use Symfony\Component\Routing\RouteCollection;
268+
269+
$collection = new RouteCollection();
260270
$collection->add('hello', new Route('/hello/{firstName}/{lastName}', array(
261271
'_controller' => 'AcmeHelloBundle:Hello:index',
262272
'color' => 'green',
263273
)));
264274
275+
return $collection;
276+
265277
The controller for this can take several arguments::
266278

267279
public function indexAction($firstName, $lastName, $color)

book/doctrine.rst

+45-46
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,16 @@ information. By convention, this information is usually configured in an
8585
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
8686
xmlns:doctrine="http://symfony.com/schema/dic/doctrine"
8787
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
88-
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
88+
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
8989
9090
<doctrine:config>
9191
<doctrine:dbal
9292
driver="%database_driver%"
9393
host="%database_host%"
9494
dbname="%database_name%"
9595
user="%database_user%"
96-
password="%database_password%"
97-
/>
96+
password="%database_password%" />
9897
</doctrine:config>
99-
10098
</container>
10199
102100
.. code-block:: php
@@ -175,16 +173,14 @@ for you:
175173
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
176174
xmlns:doctrine="http://symfony.com/schema/dic/doctrine"
177175
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
178-
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
179-
180-
<doctrine:config
181-
driver="pdo_sqlite"
182-
path="%kernel.root_dir%/sqlite.db"
183-
charset="UTF-8"
184-
>
185-
<!-- ... -->
186-
</doctrine:config>
176+
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
187177
178+
<doctrine:config>
179+
<doctrine:dbal
180+
driver="pdo_sqlite"
181+
path="%kernel.root_dir%/sqlite.db"
182+
charset="UTF-8" />
183+
</doctrine:config>
188184
</container>
189185
190186
.. code-block:: php
@@ -319,17 +315,17 @@ in a number of different formats including YAML, XML or directly inside the
319315
<!-- src/Acme/StoreBundle/Resources/config/doctrine/Product.orm.xml -->
320316
<?xml version="1.0" encoding="UTF-8" ?>
321317
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
322-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
323-
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
324-
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
318+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
319+
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
320+
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
325321
326322
<entity name="Acme\StoreBundle\Entity\Product" table="product">
327-
<id name="id" type="integer" column="id">
323+
<id name="id" type="integer">
328324
<generator strategy="AUTO" />
329325
</id>
330-
<field name="name" column="name" type="string" length="100" />
331-
<field name="price" column="price" type="decimal" scale="2" />
332-
<field name="description" column="description" type="text" />
326+
<field name="name" type="string" length="100" />
327+
<field name="price" type="decimal" scale="2" />
328+
<field name="description" type="text" />
333329
</entity>
334330
</doctrine-mapping>
335331
@@ -826,13 +822,15 @@ To do this, add the name of the repository class to your mapping definition:
826822
<!-- src/Acme/StoreBundle/Resources/config/doctrine/Product.orm.xml -->
827823
<?xml version="1.0" encoding="UTF-8" ?>
828824
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
829-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
830-
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
831-
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
825+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
826+
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
827+
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
828+
829+
<entity
830+
name="Acme\StoreBundle\Entity\Product"
831+
repository-class="Acme\StoreBundle\Entity\ProductRepository">
832832
833-
<entity name="Acme\StoreBundle\Entity\Product"
834-
repository-class="Acme\StoreBundle\Entity\ProductRepository">
835-
<!-- ... -->
833+
<!-- ... -->
836834
</entity>
837835
</doctrine-mapping>
838836
@@ -945,17 +943,18 @@ To relate the ``Category`` and ``Product`` entities, start by creating a
945943
.. code-block:: xml
946944
947945
<!-- src/Acme/StoreBundle/Resources/config/doctrine/Category.orm.xml -->
946+
<?xml version="1.0" encoding="UTF-8" ?>
948947
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
949948
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
950949
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
951-
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
950+
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
952951
953952
<entity name="Acme\StoreBundle\Entity\Category">
954953
<!-- ... -->
955-
<one-to-many field="products"
954+
<one-to-many
955+
field="products"
956956
target-entity="Product"
957-
mapped-by="category"
958-
/>
957+
mapped-by="category" />
959958
960959
<!--
961960
don't forget to init the collection in
@@ -1023,22 +1022,21 @@ object, you'll want to add a ``$category`` property to the ``Product`` class:
10231022
.. code-block:: xml
10241023
10251024
<!-- src/Acme/StoreBundle/Resources/config/doctrine/Product.orm.xml -->
1025+
<?xml version="1.0" encoding="UTF-8" ?>
10261026
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
10271027
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10281028
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
1029-
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
1029+
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
10301030
10311031
<entity name="Acme\StoreBundle\Entity\Product">
10321032
<!-- ... -->
1033-
<many-to-one field="category"
1033+
<many-to-one
1034+
field="category"
10341035
target-entity="Category"
10351036
inversed-by="products"
1036-
join-column="category"
1037-
>
1038-
<join-column
1039-
name="category_id"
1040-
referenced-column-name="id"
1041-
/>
1037+
join-column="category">
1038+
1039+
<join-column name="category_id" referenced-column-name="id" />
10421040
</many-to-one>
10431041
</entity>
10441042
</doctrine-mapping>
@@ -1306,6 +1304,8 @@ the current date, only when the entity is first persisted (i.e. inserted):
13061304

13071305
.. code-block:: php-annotations
13081306
1307+
// src/Acme/StoreBundle/Entity/Product.php
1308+
13091309
/**
13101310
* @ORM\PrePersist
13111311
*/
@@ -1328,16 +1328,15 @@ the current date, only when the entity is first persisted (i.e. inserted):
13281328
<!-- src/Acme/StoreBundle/Resources/config/doctrine/Product.orm.xml -->
13291329
<?xml version="1.0" encoding="UTF-8" ?>
13301330
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
1331-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1332-
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
1333-
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
1331+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1332+
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
1333+
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
13341334
13351335
<entity name="Acme\StoreBundle\Entity\Product">
1336-
<!-- ... -->
1337-
<lifecycle-callbacks>
1338-
<lifecycle-callback type="prePersist"
1339-
method="setCreatedAtValue" />
1340-
</lifecycle-callbacks>
1336+
<!-- ... -->
1337+
<lifecycle-callbacks>
1338+
<lifecycle-callback type="prePersist" method="setCreatedAtValue" />
1339+
</lifecycle-callbacks>
13411340
</entity>
13421341
</doctrine-mapping>
13431342

book/forms.rst

+15-14
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ corresponding to the ``task`` and ``dueDate`` properties of the ``Task`` class.
129129
You've also assigned each a "type" (e.g. ``text``, ``date``), which, among
130130
other things, determines which HTML form tag(s) is rendered for that field.
131131

132-
Finally, you added a submit button with a custom label for submitting the form to
132+
Finally, you added a submit button with a custom label for submitting the form to
133133
the server.
134134

135135
.. versionadded:: 2.3
@@ -1126,20 +1126,21 @@ easy to use in your application.
11261126
<?xml version="1.0" encoding="UTF-8" ?>
11271127
<container xmlns="http://symfony.com/schema/dic/services"
11281128
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1129-
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd>
1129+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
1130+
11301131
<services>
1131-
<service id="acme_demo.form.type.task"
1132-
class="Acme\TaskBundle\Form\Type\TaskType">
1133-
<tag name="form.type" alias="task" />
1134-
</service>
1132+
<service
1133+
id="acme_demo.form.type.task"
1134+
class="Acme\TaskBundle\Form\Type\TaskType">
1135+
1136+
<tag name="form.type" alias="task" />
1137+
</service>
11351138
</services>
11361139
</container>
11371140
11381141
.. code-block:: php
11391142
11401143
// src/Acme/TaskBundle/Resources/config/services.php
1141-
use Symfony\Component\DependencyInjection\Definition;
1142-
11431144
$container
11441145
->register(
11451146
'acme_demo.form.type.task',
@@ -1590,13 +1591,13 @@ file:
15901591
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
15911592
xmlns:twig="http://symfony.com/schema/dic/twig"
15921593
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
1593-
http://symfony.com/schema/dic/twig http://symfony.com/schema/dic/twig/twig-1.0.xsd">
1594+
http://symfony.com/schema/dic/twig http://symfony.com/schema/dic/twig/twig-1.0.xsd">
15941595
15951596
<twig:config>
1596-
<twig:form>
1597-
<twig:resource>AcmeTaskBundle:Form:fields.html.twig</twig:resource>
1598-
</twig:form>
1599-
<!-- ... -->
1597+
<twig:form>
1598+
<twig:resource>AcmeTaskBundle:Form:fields.html.twig</twig:resource>
1599+
</twig:form>
1600+
<!-- ... -->
16001601
</twig:config>
16011602
</container>
16021603
@@ -1676,7 +1677,7 @@ file:
16761677
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
16771678
xmlns:framework="http://symfony.com/schema/dic/symfony"
16781679
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
1679-
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
1680+
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
16801681
16811682
<framework:config>
16821683
<framework:templating>

book/http_cache.rst

+10-4
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,12 @@ both worlds. In other words, by using both expiration and validation, you
763763
can instruct the cache to serve the cached content, while checking back
764764
at some interval (the expiration) to verify that the content is still valid.
765765

766+
.. tip::
767+
768+
You can also define HTTP caching headers for expiration and validation by using
769+
annotations. See the
770+
:doc:`FrameworkExtraBundle documentation </bundles/SensioFrameworkExtraBundle/annotations/cache>`.
771+
766772
.. index::
767773
pair: Cache; Configuration
768774

@@ -866,8 +872,7 @@ First, to use ESI, be sure to enable it in your application configuration:
866872
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
867873
xmlns:framework="http://symfony.com/schema/dic/symfony"
868874
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
869-
http://symfony.com/schema/dic/symfony
870-
http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
875+
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
871876
872877
<framework:config>
873878
<!-- ... -->
@@ -880,7 +885,7 @@ First, to use ESI, be sure to enable it in your application configuration:
880885
// app/config/config.php
881886
$container->loadFromExtension('framework', array(
882887
// ...
883-
'esi' => array('enabled' => true),
888+
'esi' => array('enabled' => true),
884889
));
885890
886891
Now, suppose you have a page that is relatively static, except for a news
@@ -988,8 +993,9 @@ that must be enabled in your configuration:
988993
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
989994
xmlns:doctrine="http://symfony.com/schema/dic/framework"
990995
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
991-
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
996+
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
992997
998+
<!-- ... -->
993999
<framework:config>
9941000
<framework:fragments path="/_fragment" />
9951001
</framework:config>

book/http_fundamentals.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,7 @@ by adding an entry for ``/contact`` to your routing configuration file:
433433
434434
.. code-block:: xml
435435
436+
<!-- app/config/config.xml -->
436437
<?xml version="1.0" encoding="UTF-8" ?>
437438
<routes xmlns="http://symfony.com/schema/routing"
438439
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -447,8 +448,8 @@ by adding an entry for ``/contact`` to your routing configuration file:
447448
.. code-block:: php
448449
449450
// app/config/routing.php
450-
use Symfony\Component\Routing\RouteCollection;
451451
use Symfony\Component\Routing\Route;
452+
use Symfony\Component\Routing\RouteCollection;
452453
453454
$collection = new RouteCollection();
454455
$collection->add('contact', new Route('/contact', array(

book/internals.rst

+10-13
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ the configuration for the development environment:
601601
xmlns:framework="http://symfony.com/schema/dic/symfony"
602602
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
603603
http://symfony.com/schema/dic/webprofiler http://symfony.com/schema/dic/webprofiler/webprofiler-1.0.xsd
604-
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
604+
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
605605
606606
<!-- load the profiler -->
607607
<framework:config>
@@ -611,9 +611,7 @@ the configuration for the development environment:
611611
<!-- enable the web profiler -->
612612
<webprofiler:config
613613
toolbar="true"
614-
intercept-redirects="true"
615-
verbose="true"
616-
/>
614+
intercept-redirects="true" />
617615
</container>
618616
619617
.. code-block:: php
@@ -627,7 +625,6 @@ the configuration for the development environment:
627625
$container->loadFromExtension('web_profiler', array(
628626
'toolbar' => true,
629627
'intercept_redirects' => true,
630-
'verbose' => true,
631628
));
632629
633630
When ``only_exceptions`` is set to ``true``, the profiler only collects data
@@ -657,18 +654,18 @@ If you enable the web profiler, you also need to mount the profiler routes:
657654
658655
<import
659656
resource="@WebProfilerBundle/Resources/config/routing/profiler.xml"
660-
prefix="/_profiler"
661-
/>
657+
prefix="/_profiler" />
662658
</routes>
663659
664660
.. code-block:: php
665661
666-
$collection->addCollection(
667-
$loader->import(
668-
"@WebProfilerBundle/Resources/config/routing/profiler.xml"
669-
),
670-
'/_profiler'
671-
);
662+
use Symfony\Component\Routing\RouteCollection;
663+
664+
$profiler = $loader->import('@WebProfilerBundle/Resources/config/routing/profiler.xml');
665+
$profiler->addPrefix('/_profiler');
666+
667+
$collection = new RouteCollection();
668+
$collection->addCollection($profiler);
672669
673670
As the profiler adds some overhead, you might want to enable it only under
674671
certain circumstances in the production environment. The ``only_exceptions``

0 commit comments

Comments
 (0)