KnpLabs / KnpRadBundle

Rapid Application Development for Symfony2 [UNMAINTAINED]
MIT License
291 stars 49 forks source link

Add a short syntax to routing arguments #201

Closed Einenlum closed 9 years ago

Einenlum commented 10 years ago

A string argument is now a name argument by default.

Instead of using :

resources:
    edit:
        defaults:
            _resources:
                entity:
                    …
                    arguments: [{name: foo}, {value: 5}, {name: bar}, {value: norf}]

You can now use the short syntax :

arguments: [foo, {value: 5}, bar, {value: norf}]

arguments: [id] is now equivalent to arguments: [{name: id}].

(Thanks to @PedroTroller )

PedroTroller commented 10 years ago
if ($hasName) {
    return $this->requestManipulator->getAttribute($request, $options['name']);
}

Maybe you can reuse resolveName(Request $request, $name) ?

docteurklein commented 9 years ago

ready to merge?

Einenlum commented 9 years ago

@docteurklein Yes, ready to merge :D