10. Configuration Reference

The SWPMultiTenancyBundle can be configured under the swp_multi_tenancy key in your configuration file. This section describes the whole bundle’s configuration.

10.1. Full Default Configuration

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# app/config/config.yml
swp_multi_tenancy:
    use_orm_listeners: false
    persistence:
        phpcr:
            enabled: true
            basepath: "/swp"
            route_basepaths: ["routes"]
            content_basepath: "content"
            menu_baseapth: "menu"
            media_baseapth: "media"
            tenant_aware_router_class: SWP\MultiTenancyBundle\Routing\TenantAwareRouter
            classes:
                tenant:
                    model: SWP\Component\MultiTenancy\Model\Tenant
                    repository: SWP\Bundle\MultiTenancyBundle\Doctrine\PHPCR\TenantRepository
                    factory: SWP\Component\MultiTenancy\Factory\TenantFactory
                    object_manager_name: ~
                organization:
                    model: SWP\Component\MultiTenancy\Model\Organization
                    repository: SWP\Bundle\MultiTenancyBundle\Doctrine\PHPCR\OrganizationRepository
                    factory: SWP\Bundle\MultiTenancyBundle\Factory\OrganizationFactory
                    object_manager_name: ~
        orm:
            enabled: true
            classes:
                tenant:
                    model: SWP\Component\MultiTenancy\Model\Tenant
                    repository: SWP\Bundle\MultiTenancyBundle\Doctrine\ORM\TenantRepository
                    factory: SWP\Component\MultiTenancy\Factory\TenantFactory
                    object_manager_name: ~
                organization:
                    model: SWP\Component\MultiTenancy\Model\Organization
                    repository: SWP\Bundle\MultiTenancyBundle\Doctrine\ORM\OrganizationRepository
                    factory: SWP\Bundle\MultiTenancyBundle\Factory\OrganizationFactory
                    object_manager_name: ~

10.1.1. persistence

10.1.1.1. use_orm_listeners

type: Boolean default: false

Use this setting to activate the TenantableListener and TenantableSubscriber. This will enable tenantable SQL extension and will make sure your Doctrine ORM entities are tenant aware. See Event Listeners for more details.

10.1.1.2. persistence

10.1.1.2.1. phpcr
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# app/config/config.yml
swp_multi_tenancy:
    # ..
    persistence:
        phpcr:
            enabled: true
            basepath: "/swp"
            route_basepaths: ["routes"]
            content_basepath: "content"
            menu_baseapth: "menu"
            media_baseapth: "media"
            tenant_aware_router_class: SWP\MultiTenancyBundle\Routing\TenantAwareRouter
10.1.1.2.1.1. enabled

type: boolean default: false

If true, PHPCR is enabled in the service container.

PHPCR can be enabled by multiple ways such as:

1
2
3
4
5
6
phpcr: ~ # use default configuration
# or
phpcr: true # straight way
# or
phpcr:
    route_basepaths: ... # or any other option under 'phpcr'
10.1.1.2.1.2. basepath

type: string default: /swp

The basepath for documents in the PHPCR tree.

10.1.1.2.1.3. route_basepaths

type: array default: ['routes']

A set of paths where routes should be located in the PHPCR tree.

10.1.1.2.1.4. content_basepath

type: string default: content

The basepath for content objects in the PHPCR tree. This information is used to offer the correct subtree to select content documents.

10.1.1.2.1.5. media_basepath

type: string default: media

The basepath for media objects in the PHPCR tree. This information is used to offer the correct subtree to select media documents.

10.1.1.2.1.7. tenant_aware_router_class

type: string default: SWP\MultiTenancyBundle\Routing\TenantAwareRouter

The TenantAwareRouter service’s fully qualified class name to use.

10.1.1.2.1.8. classes
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# app/config/config.yml
swp_multi_tenancy:
    # ..
    persistence:
        phpcr:
            # ..
            classes:
                tenant:
                    model: SWP\Component\MultiTenancy\Model\Tenant
                    repository: SWP\Bundle\MultiTenancyBundle\Doctrine\PHPCR\TenantRepository
                    factory: SWP\Component\MultiTenancy\Factory\TenantFactory
                    object_manager_name: ~
                organization:
                    model: SWP\Component\MultiTenancy\Model\Organization
                    repository: SWP\Bundle\MultiTenancyBundle\Doctrine\PHPCR\OrganizationRepository
                    factory: SWP\Bundle\MultiTenancyBundle\Factory\OrganizationFactory
                    object_manager_name: ~
10.1.1.2.1.9. tenant.model

type: string default: SWP\Component\MultiTenancy\Model\Tenant

The FQCN of the Tenant model class which is of type TenantInterface.

10.1.1.2.1.10. tenant.factory

type: string default: SWP\Component\MultiTenancy\Factory\TenantFactory

The FQCN of the Tenant Factory class.

10.1.1.2.1.11. tenant.repository

type: string default: SWP\Bundle\MultiTenancyBundle\Doctrine\PHPCR\TenantRepository

The FQCN of the Tenant Repository class.

10.1.1.2.1.12. tenant.object_manager_name

type: string default: null

The name of the object manager. If set to null it defaults to default. If PHPCR ODM persistence backend is enabled it will register swp.object_manager.tenant service which is an alias for “doctrine_phpcr.odm.default_document_manager”.

10.1.1.2.1.13. organization.model

type: string default: SWP\Component\MultiTenancy\Model\Organization

The FQCN of the Organization model class which is of type OrganizationInterface.

10.1.1.2.1.14. organization.factory

type: string default: SWP\Bundle\MultiTenancyBundle\Factory\OrganizationFactory

The FQCN of the Organization Factory class.

10.1.1.2.1.15. organization.repository

type: string default: SWP\Bundle\MultiTenancyBundle\Doctrine\PHPCR\OrganizationRepository

The FQCN of the Organization Repository class.

10.1.1.2.1.16. organization.object_manager_name

type: string default: null

The name of the object manager. If set to null it defaults to default. If PHPCR ODM persistence backend is enabled it will register swp.object_manager.organization service which is an alias for doctrine_phpcr.odm.default_document_manager.

10.1.1.2.2. orm
1
2
3
4
5
6
# app/config/config.yml
swp_multi_tenancy:
    # ..
    persistence:
        orm:
            enabled: true
10.1.1.2.2.1. enabled

type: boolean default: false

If true, ORM is enabled in the service container.

ORM can be enabled by multiple ways such as:

1
2
3
4
5
6
orm: ~ # use default configuration
# or
orm: true # straight way
# or
orm:
    enabled: true ... # or any other option under 'orm'
10.1.1.2.2.2. classes
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# app/config/config.yml
swp_multi_tenancy:
    # ..
    persistence:
        orm:
            # ..
            classes:
                tenant:
                    model: SWP\Component\MultiTenancy\Model\Tenant
                    repository: SWP\Bundle\MultiTenancyBundle\Doctrine\ORM\TenantRepository
                    factory: SWP\Component\MultiTenancy\Factory\TenantFactory
                    object_manager_name: ~
                organization:
                    model: SWP\Component\MultiTenancy\Model\Organization
                    repository: SWP\Bundle\MultiTenancyBundle\Doctrine\ORM\OrganizationRepository
                    factory: SWP\Bundle\MultiTenancyBundle\Factory\OrganizationFactory
                    object_manager_name: ~
10.1.1.2.2.3. tenant.model

type: string default: SWP\Component\MultiTenancy\Model\Tenant

The FQCN of the Tenant model class which is of type TenantInterface.

10.1.1.2.2.4. tenant.factory

type: string default: SWP\Component\MultiTenancy\Factory\TenantFactory

The FQCN of the Tenant Factory class.

10.1.1.2.2.5. tenant.repository

type: string default: SWP\Bundle\MultiTenancyBundle\Doctrine\ORM\TenantRepository

The FQCN of the Tenant Repository class.

10.1.1.2.2.6. tenant.object_manager_name

type: string default: null

The name of the object manager. If set to null it defaults to default. If Doctrine ORM persistence backend is enabled it will register swp.object_manager.tenant service which is an alias for doctrine.orm.default_entity_manager.

10.1.1.2.2.7. organization.model

type: string default: SWP\Component\MultiTenancy\Model\Organization

The FQCN of the Organization model class which is of type OrganizationInterface.

10.1.1.2.2.8. organization.factory

type: string default: SWP\Bundle\MultiTenancyBundle\Factory\OrganizationFactory

The FQCN of the Organization Factory class.

10.1.1.2.2.9. organization.repository

type: string default: SWP\Bundle\MultiTenancyBundle\Doctrine\ORM\OrganizationRepository

The FQCN of the Organization Repository class.

10.1.1.2.2.10. organization.object_manager_name

type: string default: null

The name of the object manager. If set to null it defaults to default. If Doctrine ORM persistence backend is enabled it will register swp.object_manager.organization service which is an alias for doctrine.orm.default_entity_manager.