symfony-cmf / resource-bundle

Resource Location for CMF documents based on Puli
https://cmf.symfony.com
5 stars 7 forks source link

A default repository #10

Closed wouterj closed 9 years ago

wouterj commented 9 years ago

What do you think of configuring a default repository: One that will be used when the repository name parameter is omitted.

At the moment, anything using the ResourceBundle needs to know the repository name. As this name is purely based on the runtime configuration, every bundle needing something from the ResourceBundle is required to have a configuration option for this option.

In the case of the treeBrowserBundle, this would mean that anyone using the tree form type needs to know the repository name.

I think it would be much easier to have a default repository (are there many use-cases for multiple repositories?).

This could be done by either having a convention that the default repository is called default:

cmf_resource:
    repositories:
        default:
            # ...

Or a new option can be added:

cmf_resource:
    default_repository_name: phpcrodm
    repositories:
        phpcrodm:
            # ...

/cc @dantleech

dantleech commented 9 years ago

That sounds sensible. The main use case for multiple repositories as far as I see is building a resource tree using a mix of different repositories - e.g. combining ODM, ORM and filesystem.

default sounds like the way forward.

Be aware though that the configuration is currently;

cmf_resource:
    <repository type>
        <repository name>

so:

cmf_resource:
    repositories:
        doctrine_phpcr_odm:
            default:

Would be ideal to have:

cmf_resource:
    repository:
        default:
            type: doctrine_phpcr_odm
        orm_products:
            type: doctrine_orm
        composite_tree;
            # ...

or similar.