willdurand/Hateoas — pull request #54 by adrienbrault (2013-08-31 06:28:35+00:00)
Title: Use kitano/php-expression instead of handler system

Basically have the same expressions as in the JMSSecurityExtraBundle. See https://github.com/Kitano/php-expression

We can add an unlimited number of variables using `ExpressionEvaluator::setContextValue`. The bundle could add tagged services, the request/container etc, global variables (like in twig, defined in the bundle config).

Example having global variables and the request ( ping @lsmith77 ):

```yaml
# app/config/config.yml

bazinga_hateoas:
expressions:
variables:
BASE_REL: https://rel.site.com
```

And then use it for the relations rels:

```yaml
Acme\DemoBundle\Entity\User:
relations:
-
rel: eval BASE_REL ~ '/friends'
href:
route: user_friends
parameters:
id: eval object.getId()
_format: eval request.getRequestFormat() }
```

This definitely feels way better than the previous handler system. The only "annoying" thing is that we have to use `eval`, though it's what the JMSSecurityExtraBundle does (must be fine, right ? :P).

WDYT ?