S
S
Sergey Nitka2020-04-15 11:28:32
Yii
Sergey Nitka, 2020-04-15 11:28:32

How to set up routing in yii2 so that it is like in zend framework?

I included prettyUrl for controllers and actions, it works fine as expected
/controller/action and not r=controller/action. ok

, I have a filter where there can be a large number of parameters.
but the engine generates it all for me as
/movie/search?type=all&genre_id=4&quality_id=6&year=2020&rating=[8,10]

I need it to be like in the zend framework by default
/controller/action/:param1/:value1/: param2/:value2
how can such logic be achieved from the router. so that everything that comes after action is perceived as key-value query parameters for all project urls globally.

/movie/search/type/all/genre_id/4/quality_id/6/year/2020/rating/[8,10]
/movie/search/genre_id/4/rating/[8,10]
/movie/search/year/2020/rating/[8,10]
and any of them, apparently, can be omitted

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2020-04-18
@Rumzik

How to set up routing in yii2 so that it is like in zend framework?

Install Zend
And if the case:
1. Read the documentation.
2. The route is processed with regular expressions (or without them)
3. The route is very simple: address => redirect. for example
'afisha/past/default/all' => 'afisha/past/all'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question