In this way we can separate the logic of URL from controller name and action name. We will also able to move our action and the URL will work with no others modifications.
I mean something like this:
/**
* @Pattern("/post/show/{id}")
*/
public function actionShow($id)
{
// ...
}
or better:
/**
* @Pattern("/post/show/{id}")
*/
public function blalblalblaName($id)
{
// ...
}
Whit reflection we can see comments:
<?php
/**
* A test class
*
* @param foo bar
* @return baz
*/
class TestClass { }
$rc = new ReflectionClass('TestClass');
var_dump($rc->getDocComment())
?>
The above example will output:
string(55) "/** * A test class * * @param foo bar * @return baz */"
And we will can also read annotation and generate url for config file when It needed.

Help
This topic is locked















