Skip to content

Commit ab0fb08

Browse files
committed
Merge branch '2.1'
2 parents 6fd1c27 + b63750b commit ab0fb08

File tree

2 files changed

+53
-19
lines changed

2 files changed

+53
-19
lines changed

components/routing.rst

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,15 @@ your autoloader to load the Routing component::
3434
use Symfony\Component\Routing\RouteCollection;
3535
use Symfony\Component\Routing\Route;
3636

37+
$route = new Route('/foo', array('controller' => 'MyController'))
3738
$routes = new RouteCollection();
38-
$routes->add('route_name', new Route('/foo', array('controller' => 'MyController')));
39+
$routes->add('route_name', $route);
3940

4041
$context = new RequestContext($_SERVER['REQUEST_URI']);
4142

4243
$matcher = new UrlMatcher($routes, $context);
4344

44-
$parameters = $matcher->match('/foo');
45+
$parameters = $matcher->match('/foo');
4546
// array('controller' => 'MyController', '_route' => 'route_name')
4647

4748
.. note::
@@ -97,7 +98,11 @@ Take the following route, which combines several of these ideas::
9798
// ...
9899

99100
$parameters = $matcher->match('/archive/2012-01');
100-
// array('controller' => 'showArchive', 'month' => '2012-01', '_route' => ...)
101+
// array(
102+
// 'controller' => 'showArchive',
103+
// 'month' => '2012-01',
104+
// '_route' => ...
105+
// )
101106

102107
$parameters = $matcher->match('/archive/foo');
103108
// throws ResourceNotFoundException
@@ -115,15 +120,22 @@ you can define:
115120
For example, the following route would only accept requests to /foo with
116121
the POST method and a secure connection::
117122

118-
$route = new Route('/foo', array(), array('_method' => 'post', '_scheme' => 'https' ));
123+
$route = new Route(
124+
'/foo',
125+
array(),
126+
array('_method' => 'post', '_scheme' => 'https' )
127+
);
119128

120129
.. tip::
121130

122131
If you want to match all urls which start with a certain path and end in an
123132
arbitrary suffix you can use the following route definition::
124133

125-
$route = new Route('/start/{suffix}', array('suffix' => ''), array('suffix' => '.*'));
126-
134+
$route = new Route(
135+
'/start/{suffix}',
136+
array('suffix' => ''),
137+
array('suffix' => '.*')
138+
);
127139

128140
Using Prefixes
129141
~~~~~~~~~~~~~~
@@ -139,7 +151,11 @@ default requirements and default options to all routes of a subtree::
139151
$subCollection->add(...);
140152
$subCollection->add(...);
141153

142-
$rootCollection->addCollection($subCollection, '/prefix', array('_scheme' => 'https'));
154+
$rootCollection->addCollection(
155+
$subCollection,
156+
'/prefix',
157+
array('_scheme' => 'https')
158+
);
143159

144160
Set the Request Parameters
145161
~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -148,14 +164,21 @@ The :class:`Symfony\\Component\\Routing\\RequestContext` provides information
148164
about the current request. You can define all parameters of an HTTP request
149165
with this class via its constructor::
150166

151-
public function __construct($baseUrl = '', $method = 'GET', $host = 'localhost', $scheme = 'http', $httpPort = 80, $httpsPort = 443)
167+
public function __construct(
168+
$baseUrl = '',
169+
$method = 'GET',
170+
$host = 'localhost',
171+
$scheme = 'http',
172+
$httpPort = 80,
173+
$httpsPort = 443
174+
)
152175

153176
.. _components-routing-http-foundation:
154177

155178
Normally you can pass the values from the ``$_SERVER`` variable to populate the
156179
:class:`Symfony\\Component\\Routing\\RequestContext`. But If you use the
157-
:doc:`HttpFoundation</components/http_foundation/index>` component, you can use its
158-
:class:`Symfony\\Component\\HttpFoundation\\Request` class to feed the
180+
:doc:`HttpFoundation</components/http_foundation/index>` component, you can use its
181+
:class:`Symfony\\Component\\HttpFoundation\\Request` class to feed the
159182
:class:`Symfony\\Component\\Routing\\RequestContext` in a shortcut::
160183

161184
use Symfony\Component\HttpFoundation\Request;
@@ -242,7 +265,10 @@ have to provide the name of a php file which returns a :class:`Symfony\\Componen
242265
use Symfony\Component\Routing\Route;
243266

244267
$collection = new RouteCollection();
245-
$collection->add('route_name', new Route('/foo', array('controller' => 'ExampleController')));
268+
$collection->add(
269+
'route_name',
270+
new Route('/foo', array('controller' => 'ExampleController'))
271+
);
246272
// ...
247273

248274
return $collection;
@@ -278,7 +304,13 @@ The :class:`Symfony\\Component\\Routing\\Router` class is a all-in-one package
278304
to quickly use the Routing component. The constructor expects a loader instance,
279305
a path to the main route definition and some other settings::
280306

281-
public function __construct(LoaderInterface $loader, $resource, array $options = array(), RequestContext $context = null, array $defaults = array());
307+
public function __construct(
308+
LoaderInterface $loader,
309+
$resource,
310+
array $options = array(),
311+
RequestContext $context = null,
312+
array $defaults = array()
313+
);
282314

283315
With the ``cache_dir`` option you can enable route caching (if you provide a
284316
path) or disable caching (if it's set to ``null``). The caching is done

cookbook/security/acl.rst

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,18 @@ First, we need to configure the connection the ACL system is supposed to use:
6161
6262
.. note::
6363

64-
The ACL system requires at least one Doctrine DBAL connection to be
65-
configured. However, that does not mean that you have to use Doctrine for
66-
mapping your domain objects. You can use whatever mapper you like for your
67-
objects, be it Doctrine ORM, Mongo ODM, Propel, or raw SQL, the choice is
68-
yours.
64+
The ACL system requires a connection from either Doctrine DBAL (usable by
65+
default) or Doctrine MongoDB (usable with `MongoDBAclBundle`_). However,
66+
that does not mean that you have to use Doctrine ORM or ODM for mapping your
67+
domain objects. You can use whatever mapper you like for your objects, be it
68+
Doctrine ORM, MongoDB ODM, Propel, raw SQL, etc. The choice is yours.
6969

7070
After the connection is configured, we have to import the database structure.
7171
Fortunately, we have a task for this. Simply run the following command:
7272

73-
.. code-block:: text
73+
.. code-block:: bash
7474
75-
php app/console init:acl
75+
$ php app/console init:acl
7676
7777
Getting Started
7878
---------------
@@ -216,3 +216,5 @@ added above:
216216
$acl->insertObjectAce($identity, $mask);
217217
218218
The user is now allowed to view, edit, delete, and un-delete objects.
219+
220+
.. _`MongoDBAclBundle`: https://github.com/IamPersistent/MongoDBAclBundle

0 commit comments

Comments
 (0)