11.1. CMF RoutingBundle Integration¶
The SWPMultiTenancyBundle can be integrated with the CMF RoutingBundle. This section describes how to integrate the CMF Routing Bundle when using PHPCR ODM or ORM as persistence backends.
Note
If you don’t have CMF RoutingBundle installed, see the documentation on how to install and configure it.
11.1.1. Doctrine PHPCR ODM integration¶
11.1.1.1. Enable PHPCR persistence backend¶
Make sure the PHPCR persistence backend is enabled in CMF RoutingBundle.
You need to enable the PHPCR as a persistence backend for the SWPMultiTenancyBundle and fully integrate this bundle with the CMF RoutingBundle. Add the following lines to the configuration file:
1 2 3 4 5 6 7 8 9 10 | # app/config/config.yml
swp_multi_tenancy:
persistence:
phpcr:
# if true, PHPCR is enabled in the service container
enabled: true
# route base paths under which routes will be stored
route_basepaths: ["routes"]
# PHPCR content base path under which content will be stored
content_basepath: "content"
|
Once the enabled
property is set to true, PHPCRBasePathsInitializer,
TenantAwareRouter and PrefixCandidates
will be available in the application.
11.1.1.2. Enable TenantAwareRouter¶
To register the TenantAwareRouter service in the CMF RoutingBundle, add the following lines to your configuration file:
1 2 3 4 5 6 | cmf_routing:
chain:
routers_by_id:
# other routers
# TenantAwareRouter with the priority of 150
swp_multi_tenancy.tenant_aware_router: 150
|
The RoutingBundle example configuration can be found here:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | cmf_routing:
chain:
routers_by_id:
# default Symfony Router
router.default: 200
# TenantAwareRouter
swp_multi_tenancy.tenant_aware_router: 150
# CMF Dynamic Router
cmf_routing.dynamic_router: 100
dynamic:
route_collection_limit: 100
persistence:
phpcr:
enabled: true
|
Note
Please see the documentation of the CMF RoutingBundle for more details.
11.1.2. Doctrine ORM integration¶
Not implemented yet.