Question

I am looking for a tool(class or method or ...) in Yii that, get a string (a url) and return an array contains module, controller, action and other get_params.

I cannot use explode because it is possible that module dose not exists or can not find out that 'a/b' is module/controller or controller/action !

Was it helpful?

Solution

This is kind a weird of Yii - why I can't just do something similar to:

$this->uri->segment(1);

Many FWs have this feature, so simple and obvious.

PS Also, why I should write methods in Helpers like above to do things FW must definitely do? And yes I don't want to act like:

$request = new Request();
$request->setUrl('/site/contact');

Yii::$app->urlManager->parseRequest($request);

This is totally stupid, not after setting the url - just f***ing grab it like in old wonderful days. They should write an alternative either.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top