Url rules for all url

How create url tules for all url?

page/,

cat1/page/,

cat1/cat2/cat3/page/,

cat1/cat2/cat3/product/,

all!




       'urlManager' => [

            'enablePrettyUrl' => true,

            'showScriptName' => false,

            'rules' => [

                [

                    //'class' => 'app\components\TrueUrlRule',

                ],

            ]


        ],






<?php


namespace app\components;


use yii\web\UrlRuleInterface;

use yii\base\Object;


class TrueUrlRule extends Object implements UrlRuleInterface

{


    public function createUrl($manager, $route, $params)

    {

      /*  echo 100;

        if ($route === 'car/index') {

            if (isset($params['manufacturer'], $params['model'])) {

                return $params['manufacturer'] . '/' . $params['model'];

            } elseif (isset($params['manufacturer'])) {

                return $params['manufacturer'];

            }

        }

        return false; 

		*/

    }




    public function parseRequest($manager, $request)

    {

        //$pathInfo = $request->getPathInfo();

     //   print_r( $pathInfo );

        echo 111;

    }

}

?>






Error


Unsupported operand types

1. in D:\OPENSERV2\OpenServer\domains\news-site2\vendor\yiisoft\yii2\web\Request.php at line 188

179180181182183184185186187188189190191192193194195196197     * @return array the first element is the route, and the second is the associated parameters.

     * @throws NotFoundHttpException if the request cannot be resolved.

     */

    public function resolve()

    {

        $result = Yii::$app->getUrlManager()->parseRequest($this);

        if ($result !== false) {

            list ($route, $params) = $result;

            if ($this->_queryParams === null) {

                $_GET = $params + $_GET; // preserve numeric keys

            } else {

                $this->_queryParams = $params + $this->_queryParams;

            }

            return [$route, $this->getQueryParams()];

        }

 

        throw new NotFoundHttpException(Yii::t('yii', 'Page not found.'));

    }

 




http://www.yiiframework.com/doc-2.0/guide-runtime-routing.html#catchall-route


'rules' => [

   'catchAll' => ['page/create1'],

]





Unknown Property – yii\base\UnknownPropertyException


Setting unknown property: yii\web\UrlRule::0

1. in D:\OPENSERV2\OpenServer\domains\news-site2\vendor\yiisoft\yii2\base\Object.php at line 161

152153154155156157158159160161162163164165166167168169170     */

    public function __set($name, $value)

    {

        $setter = 'set' . $name;

        if (method_exists($this, $setter)) {

            $this->$setter($value);

        } elseif (method_exists($this, 'get' . $name)) {

            throw new InvalidCallException('Setting read-only property: ' . get_class($this) . '::' . $name);

        } else {

            throw new UnknownPropertyException('Setting unknown property: ' . get_class($this) . '::' . $name);

        }

    }

 

    /**

     * Checks if a property is set, i.e. 

if you look at the docs it’s an application configuration. You need to move the ‘catchAll’ param out of the urlManager configuration into the base application settings i.e. inline with components array that it’s currently part of.