@@ -284,27 +284,63 @@ the validation and saves the data into the database::
284
284
Add New Routes
285
285
--------------
286
286
287
- Next, update your routes
287
+ Next, update your routes. If you're placing your routes inside your bundle
288
+ (as shown here), don't forget to make sure that the routing file is being
289
+ :ref: `imported<routing-include-external-resources> `.
288
290
289
- .. code -block :: yml
291
+ .. configuration -block ::
290
292
291
- register:
292
- pattern: /register
293
- defaults: { _controller: AcmeAccountBundle:Account:register }
293
+ .. code-block :: yml
294
+
295
+ # src/Acme/AccountBundle/Resources/config/routing.yml
296
+ account_register:
297
+ pattern: /register
298
+ defaults: { _controller: AcmeAccountBundle:Account:register }
294
299
295
- create :
296
- pattern: /create
297
- defaults: { _controller: AcmeAccountBundle:Account:create }
300
+ account_create :
301
+ pattern: /register /create
302
+ defaults: { _controller: AcmeAccountBundle:Account:create }
298
303
299
- Run Doctrine Commands
300
- ---------------------
304
+ .. code-block :: xml
305
+
306
+ <!-- src/Acme/AccountBundle/Resources/config/routing.xml -->
307
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
308
+ <routes xmlns =" http://symfony.com/schema/routing"
309
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
310
+ xsi : schemaLocation =" http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd" >
311
+
312
+ <route id =" account_register" path =" /register" >
313
+ <default key =" _controller" >AcmeAccountBundle:Account:register</default >
314
+ </route >
315
+
316
+ <route id =" account_create" path =" /register/create" >
317
+ <default key =" _controller" >AcmeAccountBundle:Account:create</default >
318
+ </route >
319
+ </routes >
301
320
302
- Finally, generate your entities and schema
321
+ .. code-block :: php
322
+
323
+ // src/Acme/AccountBundle/Resources/config/routing.php
324
+ use Symfony\Component\Routing\RouteCollection;
325
+ use Symfony\Component\Routing\Route;
326
+
327
+ $collection = new RouteCollection();
328
+ $collection->add('account_register', new Route('/register', array(
329
+ '_controller' => 'AcmeAccountBundle:Account:register',
330
+ )));
331
+ $collection->add('account_create', new Route('/register/create', array(
332
+ '_controller' => 'AcmeAccountBundle:Account:create',
333
+ )));
334
+
335
+ return $collection;
336
+
337
+ Update your Database Schema
338
+ ---------------------------
303
339
304
- .. code-block ::
340
+ Of course, since you've added a ``User `` entity during this tutorial, make
341
+ sure that your database schema has been updated properly:
305
342
306
- php app/console doctrine:database:create
307
- php app/console doctrine:schema:update --force
343
+ $ php app/console doctrine:schema: update --force
308
344
309
345
That's it! Your form now validates, and allows you to save the ``User ``
310
346
object to the database. The extra ``terms `` checkbox on the ``Registration ``
0 commit comments