ezsystems/ezpublish-community — pull request #97 by bdunogier (2014-01-25 16:23:02+00:00)
Title: Made the EzPublishKernel extensible

> Status: proof of concept

This PR implements an extensible `EzPublishKernel`.

### Benefits
it lets you create eZ Publish projects without modifying the native `ezpublish` folder.
Any change to eZ Publish itself (new bundles, configuration...) will automatically be applied to all of your projects.
It also makes it very easy to host *multiple, independent projects* on the same eZ Publish 5 installation. Each project has its own configuration, cache, logs... without messing with environments.

### Principle
Custom apps use their own kernel dir, with a custom application kernel that extends `EzPublishExtensibleKernel`.
The app kernel takes care of loading bundles for the application itself; the bundles required by eZ Publish will be loaded by the parent kernel class.

This extensible kernel also defines a new kernel parameter, %ez_kernel.root_dir%, set to the ezpublish kernel folder (`ezpublish/`). This parameter is used by eZ Publish itself to reference external files. (see Issues below)

Configuration is handled as follows:

#### `config.yml`
Will be loaded twice:
- from `ezpublish/config/config_.yml`
- from `app/config/config_.yml` (if the file exists), overriding any value defined in the file from `ezpublish`

#### `ezpublish.yml`
Will be loaded:
- either from `app/config/ezpublish_.yml` if it exists
- or from `ezpublish/config/ezpublish_.yml` (if it doesn't exist, `ezpublish_setup.yml` is loaded as expected.

#### `routing.yml`
If a new location isn't redefined in the app's `config.yml` (`framework.router.resource`), `ezpublish/config/routing.yml` is loaded.
If a new location is defined, it is used _instead_ of the original one. *It is required that you **copy** the original routing.yml* file to the app so that the eZ Publish routes are loaded. Any way to automate that would be appreciated.

#### `parameters.yml`
Not sure, actually ! Would appreciate insights on this.

### Issues

#### `%ezpublish_kernel.root_dir%`
YAML files in `ezpublish-kernel` sometimes reference static files (`.tr`, `.xsl`) using the `%kernel.root_dir%` kernel parameter as the base directory.
Since this project layout changes the kernel directory, those inclusions may break (depending on how deep your app folder is). The workaround is to use `%ez_kernel.root_dir%` in those files instead. This would require that the definition of this parameter is moved up from `EzPublishExtensibleKernel` to `EzPublishKernel`.