symfony-cmf/RoutingAutoBundle — pull request #72 by WouterJ (2014-03-01 17:16:00+00:00)
Title: Refactor to URL Schema

This will be our new base for the URL Schema thing :)

What I've done
--------------

I've worked on the loading of the mapping till the `Factory`. I've:
- included a `YmlFileLoader` as an example
- updated the `CmfRoutingAutoExtension`
- updated the `Configuration`
- Started updating the tests (they are failing mostly because of: wrong file locations and the mix of old + new config format)

Todo
----

- [ ] Adding caching, I've already done some work on this (see commented code in `Factory`). But it's far from complete, as a temporary fix I've created a `MappingFactoryBuilder` to load the config and include it in the `Factory`, so we at last use the Container caching.
- [ ] Refactoring the component to use the URL schema technique. This will start in the `Factory`, which I've mostly updated.
- [ ] Fixing the rest of the tests, this will be done mostly by the prev. todo, but needs some more love for the location of mapping config files.

How it works
------------

The mapping configuration is loaded by the `DelegatingLoader` of the Config component. Only the `YmlFileLoader` is included atm. This will result in an array of `MappingData` objects, each object holds the URL schema + path units for one class. The `MappingData` contains `PathUnit` objects, which hold the configuration for each path unit.

This is all loaded in the `MappingFactory` object. That object deals with the mapping information. It is included in the `Factory`, so the `Factory` can request for mapping configuration.

The config files are discovered by the `CmfRoutingAutoExtension`, which uses both auto mapping (if enabled) and it uses configured paths.

In the future, the `Factory` will get the `DelegatingLoader` and the `resources` and create the `MetadataFactory` object himself (and caches it in the file system). Because caching is not supported, there is a `MetadataFactoryBuilder` class which creates the `MetadataFactory` and inject that into the `Factory`.