| 44 | | ==== Translation ==== |
| 45 | | * [http://symfony.com/doc/current/components/translation.html The Translation Component] |
| 46 | | * [http://symfony.com/doc/current/session/locale_sticky_session.html Making the Locale "Sticky" during a User's Session] See HttpFoundation component. |
| 47 | | * see Bundle-Form-Translation |
| 48 | | * see Bundle-Admin-Translation |
| 49 | | ==== Guard (New in 2.8!) ==== |
| | 48 | ==== Routing ==== |
| | 49 | ===== RouteCollection vs RouteCollectionBuilder ===== |
| | 50 | {{{#!th |
| | 51 | **[http://api.symfony.com/master/Symfony/Component/Routing/RouteCollection.html RouteCollection]** |
| | 52 | }}} |
| | 53 | {{{#!th |
| | 54 | **[http://api.symfony.com/master/Symfony/Component/Routing/RouteCollectionBuilder.html RouteCollectionBuilder]** |
| | 55 | }}} |
| | 56 | |---------------- |
| | 57 | || || || |
| | 58 | {{{#!td rowspan=2 |
| | 59 | **add**(string $name, Route $route) |
| | 60 | }}} |
| | 61 | {{{#!td |
| | 62 | $this **addRoute**(Route $route, string|null $name = null) |
| | 63 | }}} |
| | 64 | |---------------- |
| | 65 | {{{#!td |
| | 66 | Route **add**(string $path, string $controller, string|null $name = null |
| | 67 | }}} |
| | 68 | |---------------- |
| | 69 | {{{#!td |
| | 70 | {{{#!js |
| | 71 | new RouteCollection()->add('root', new Route('/', [ |
| | 72 | '_controller' => 'FrameworkBundle:Redirect:redirect', |
| | 73 | 'route' => 'sonata_admin_dashboard', |
| | 74 | 'permanent' => true, |
| | 75 | ])); // to check |
| | 76 | }}} |
| | 77 | }}} |
| | 78 | {{{#!td |
| | 79 | {{{#!js |
| | 80 | new RouteCollectionBuilder()->addRoute(new Route('/', [ |
| | 81 | '_controller' => 'FrameworkBundle:Redirect:redirect', |
| | 82 | 'route' => 'sonata_admin_dashboard', |
| | 83 | 'permanent' => true, |
| | 84 | ]), |
| | 85 | 'root' |
| | 86 | ); // to check |
| | 87 | }}} |
| | 88 | }}} |
| | 89 | |---------------- |
| | 90 | {{{#!td |
| | 91 | //Does not exist: cf// $loader->**import**(...) |
| | 92 | }}} |
| | 93 | {{{#!td |
| | 94 | RouteCollectionBuilder **import**(mixed $resource, string|null $prefix = '/', string $type = null) |
| | 95 | }}} |
| | 96 | |---------------- |
| | 97 | {{{#!td |
| | 98 | //Does not exist: cf// **addCollection** |
| | 99 | }}} |
| | 100 | {{{#!td |
| | 101 | **mount**($prefix, RouteCollectionBuilder $builder) |
| | 102 | }}} |
| | 103 | |---------------- |
| | 104 | {{{#!td |
| | 105 | {{{#!js |
| | 106 | $collection = new RouteCollection(); |
| | 107 | $routing = $loader->import( |
| | 108 | "@SonataAdminBundle/Resources/config/sonata_admin.xml" |
| | 109 | ); |
| | 110 | $routing->setPrefix('/admin'); |
| | 111 | $collection->addCollection($routing); |
| | 112 | }}} |
| | 113 | }}} |
| | 114 | {{{#!td |
| | 115 | {{{#!js |
| | 116 | $routes->mount('/admin', $routes->import('@SonataAdminBundle/Resources/config/routing/sonata_admin.xml')); |
| | 117 | }}} |
| | 118 | }}} |
| | 119 | |---------------- |
| | 120 | Written for 3.0 |
| | 121 | * [http://symfony.com/doc/current/cmf/tutorial/sonata-admin.html cmf/tutorial/sonata-admin] |
| | 122 | * [http://symfony.com/doc/current/cookbook/routing/custom_route_loader.html cookbook/routing/custom_route_loader] |
| | 123 | ==== Security ==== |
| | 124 | ===== Guard (New in 2.8!) ===== |
| 60 | | ==== Routing ==== |
| 61 | | ===== RouteCollection vs RouteCollectionBuilder ===== |
| 62 | | {{{#!th |
| 63 | | **[http://api.symfony.com/master/Symfony/Component/Routing/RouteCollection.html RouteCollection]** |
| 64 | | }}} |
| 65 | | {{{#!th |
| 66 | | **[http://api.symfony.com/master/Symfony/Component/Routing/RouteCollectionBuilder.html RouteCollectionBuilder]** |
| 67 | | }}} |
| 68 | | |---------------- |
| 69 | | || || || |
| 70 | | {{{#!td rowspan=2 |
| 71 | | **add**(string $name, Route $route) |
| 72 | | }}} |
| 73 | | {{{#!td |
| 74 | | $this **addRoute**(Route $route, string|null $name = null) |
| 75 | | }}} |
| 76 | | |---------------- |
| 77 | | {{{#!td |
| 78 | | Route **add**(string $path, string $controller, string|null $name = null |
| 79 | | }}} |
| 80 | | |---------------- |
| 81 | | {{{#!td |
| 82 | | {{{#!js |
| 83 | | new RouteCollection()->add('root', new Route('/', [ |
| 84 | | '_controller' => 'FrameworkBundle:Redirect:redirect', |
| 85 | | 'route' => 'sonata_admin_dashboard', |
| 86 | | 'permanent' => true, |
| 87 | | ])); // to check |
| 88 | | }}} |
| 89 | | }}} |
| 90 | | {{{#!td |
| 91 | | {{{#!js |
| 92 | | new RouteCollectionBuilder()->addRoute(new Route('/', [ |
| 93 | | '_controller' => 'FrameworkBundle:Redirect:redirect', |
| 94 | | 'route' => 'sonata_admin_dashboard', |
| 95 | | 'permanent' => true, |
| 96 | | ]), |
| 97 | | 'root' |
| 98 | | ); // to check |
| 99 | | }}} |
| 100 | | }}} |
| 101 | | |---------------- |
| 102 | | {{{#!td |
| 103 | | //Does not exist: cf// $loader->**import**(...) |
| 104 | | }}} |
| 105 | | {{{#!td |
| 106 | | RouteCollectionBuilder **import**(mixed $resource, string|null $prefix = '/', string $type = null) |
| 107 | | }}} |
| 108 | | |---------------- |
| 109 | | {{{#!td |
| 110 | | //Does not exist: cf// **addCollection** |
| 111 | | }}} |
| 112 | | {{{#!td |
| 113 | | **mount**($prefix, RouteCollectionBuilder $builder) |
| 114 | | }}} |
| 115 | | |---------------- |
| 116 | | {{{#!td |
| 117 | | {{{#!js |
| 118 | | $collection = new RouteCollection(); |
| 119 | | $routing = $loader->import( |
| 120 | | "@SonataAdminBundle/Resources/config/sonata_admin.xml" |
| 121 | | ); |
| 122 | | $routing->setPrefix('/admin'); |
| 123 | | $collection->addCollection($routing); |
| 124 | | }}} |
| 125 | | }}} |
| 126 | | {{{#!td |
| 127 | | {{{#!js |
| 128 | | $routes->mount('/admin', $routes->import('@SonataAdminBundle/Resources/config/routing/sonata_admin.xml')); |
| 129 | | }}} |
| 130 | | }}} |
| 131 | | |---------------- |
| 132 | | Written for 3.0 |
| 133 | | * [http://symfony.com/doc/current/cmf/tutorial/sonata-admin.html cmf/tutorial/sonata-admin] |
| 134 | | * [http://symfony.com/doc/current/cookbook/routing/custom_route_loader.html cookbook/routing/custom_route_loader] |
| | 135 | ==== Translation ==== |
| | 136 | * [http://symfony.com/doc/current/components/translation.html The Translation Component] |
| | 137 | * [http://symfony.com/doc/current/session/locale_sticky_session.html Making the Locale "Sticky" during a User's Session] See HttpFoundation component. |
| | 138 | * see Bundle-Form-Translation |
| | 139 | * see Bundle-Admin-Translation |