symfony-cmf/RoutingAuto — pull request #22 by dantleech (2014-12-06 09:21:51+00:00)
Title: [REJECTED] Experiment scheme host

This PR is In reponse to the PR https://github.com/symfony-cmf/RoutingAuto/pull/21 which adds support for mapping arbitrary values to route methods, which aims to solve the issue #21.

It adds support for adding a host, schemes [ http, https ], and route *options* to the routing auto configuration:

````yaml
foobar:
uri_schema: bar/foo
host_schema: sub.{domain}.com
token_providers:
domain: [ content_method, {method: 'getDomain'} ]
allowed_schemes: [ https ]
route_options:
custom_option: one
custom_option: two
````

All of the above options can be mapped directly to Symfonys Route object.

There are problems however with the **host_schema**:

- We will need to refactor conflict resolution
- We need to change the adapter interface
- Token provides now have a dual role in providing tokens for URLs and Hosts -
which are two different things.

And, for all that **I do not think it good practice to store the host name
in the route**, neither in PHPCR or in an ORM. This is breaking the DRY rule.

The host name would be better placed (in PHPCR) as part of the path, and in
an ORM as an ID refering to some Host table.

Saying that, storing the host or anyother attribute in the Route document could
be easily facilitated if we implement an EventDispatcher.