Skip to content

Commit b1777b7

Browse files
ricardclauwouterj
authored andcommitted
some more missing formats
1 parent f15121e commit b1777b7

File tree

4 files changed

+102
-19
lines changed

4 files changed

+102
-19
lines changed

cookbook/configuration/apache_router.rst

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,33 @@ Change Router Configuration Parameters
1313
To dump Apache routes you must first tweak some configuration parameters to tell
1414
Symfony2 to use the ``ApacheUrlMatcher`` instead of the default one:
1515

16-
.. code-block:: yaml
16+
.. configuration-block::
1717

18-
# app/config/config_prod.yml
19-
parameters:
20-
router.options.matcher.cache_class: ~ # disable router cache
21-
router.options.matcher_class: Symfony\Component\Routing\Matcher\ApacheUrlMatcher
18+
.. code-block:: yaml
19+
20+
# app/config/config_prod.yml
21+
parameters:
22+
router.options.matcher.cache_class: ~ # disable router cache
23+
router.options.matcher_class: Symfony\Component\Routing\Matcher\ApacheUrlMatcher
24+
25+
.. code-block:: xml
26+
27+
<!-- app/config/config_prod.xml -->
28+
<parameters>
29+
<parameter key="router.options.matcher.cache_class">null</parameter> <!-- disable router cache -->
30+
<parameter key="router.options.matcher_class">
31+
Symfony\Component\Routing\Matcher\ApacheUrlMatcher
32+
</parameter>
33+
</parameters>
34+
35+
.. code-block:: php
36+
37+
// app/config/config_prod.php
38+
$container->setParameter('router.options.matcher.cache_class', null); // disable router cache
39+
$container->setParameter(
40+
'router.options.matcher_class',
41+
'Symfony\Component\Routing\Matcher\ApacheUrlMatcher'
42+
);
2243
2344
.. tip::
2445

@@ -33,13 +54,28 @@ Generating mod_rewrite rules
3354

3455
To test that it's working, let's create a very basic route for demo bundle:
3556

36-
.. code-block:: yaml
57+
.. configuration-block::
58+
59+
.. code-block:: yaml
60+
61+
# app/config/routing.yml
62+
hello:
63+
pattern: /hello/{name}
64+
defaults: { _controller: AcmeDemoBundle:Demo:hello }
65+
66+
.. code-block:: xml
67+
68+
<!-- app/config/routing.xml -->
69+
<route id="hello" pattern="/hello/{name}">
70+
<default key="_controller">AcmeDemoBundle:Demo:hello</default>
71+
</route>
3772
38-
# app/config/routing.yml
39-
hello:
40-
pattern: /hello/{name}
41-
defaults: { _controller: AcmeDemoBundle:Demo:hello }
73+
.. code-block:: php
4274
75+
// app/config/routing.php
76+
$collection->add('hello', new Route('/hello/{name}', array(
77+
'_controller' => 'AcmeDemoBundle:Demo:hello',
78+
)));
4379
4480
Now generate **url_rewrite** rules:
4581

cookbook/configuration/external_parameters.rst

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,19 @@ key, and define the type as ``constant``.
117117
This only works for XML configuration. If you're *not* using XML, simply
118118
import an XML file to take advantage of this functionality:
119119

120-
.. code-block:: yaml
120+
.. configuration-block::
121+
122+
.. code-block:: yaml
123+
124+
# app/config/config.yml
125+
imports:
126+
- { resource: parameters.xml }
127+
128+
.. code-block:: php
129+
130+
// app/config/config.php
131+
$loader->import('parameters.xml');
121132
122-
# app/config/config.yml
123-
imports:
124-
- { resource: parameters.xml }
125133
126134
Miscellaneous Configuration
127135
---------------------------

cookbook/configuration/override_dir_structure.rst

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,33 @@ may need to modify the paths inside these files::
101101
If you use the AsseticBundle you need to configure this, so it can use
102102
the correct ``web`` directory:
103103

104-
.. code-block:: yaml
104+
.. configuration-block::
105105

106-
# app/config/config.yml
106+
.. code-block:: yaml
107+
108+
# app/config/config.yml
107109
108-
# ...
109-
assetic:
110110
# ...
111-
read_from: "%kernel.root_dir%/../../public_html"
111+
assetic:
112+
# ...
113+
read_from: "%kernel.root_dir%/../../public_html"
114+
115+
.. code-block:: xml
116+
117+
<!-- app/config/config.xml -->
118+
119+
<!-- ... -->
120+
<assetic:config read_from="%kernel.root_dir%/../../public_html" />
121+
122+
.. code-block:: php
123+
124+
// app/config/config.php
125+
126+
// ...
127+
$container->loadFromExtension('assetic', array(
128+
// ...
129+
'read_from' => '%kernel.root_dir%/../../public_html',
130+
));
112131
113132
Now you just need to dump the assets again and your application should
114133
work:

cookbook/testing/http_authentication.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,23 @@ key in your firewall, along with the ``form_login`` key:
3434
firewalls:
3535
your_firewall_name:
3636
http_basic:
37+
38+
.. code-block:: xml
39+
40+
<!-- app/config/config_test.xml -->
41+
<security:config>
42+
<firewall name="your_firewall_name">
43+
<http-basic />
44+
</firewall>
45+
</security:config>
46+
47+
.. code-block:: php
48+
49+
// app/config/config_test.php
50+
$container->loadFromExtension('security', array(
51+
'firewalls' => array(
52+
'your_firewall_name' => array(
53+
'http-basic' => array(),
54+
),
55+
),
56+
));

0 commit comments

Comments
 (0)