Custom url class doesn't append url suffix.

I needed to use a custom url class to generate/parse some database rules:




class PageUrlRule extends CBaseUrlRule

{

    public $connectionID = 'db';

 

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

    {

        if($route==='page/index')

        {

            if(isset($params['nice_url']))

                return $params['nice_url'];

        }

        return false;  // this rule does not apply

    }

 

    public function parseUrl($manager,$request,$pathInfo,$rawPathInfo)

    {

        if(preg_match('%^[a-z0-9\-\/]+$%', $pathInfo, $matches))

        {

            $url=$matches[0];

            if(strpos($url,'/')!==false)

            {

                $urlPieces=explode('/',$url);

                $url=end($urlPieces);

            }

            $command=Yii::app()->{$this->connectionID}->createCommand();

            $result=$command->select('url_path')->from('{{page}}');

            $result->where('nice_url=:url AND `status`=:st', array(':url'=>$url,':st'=>Page::STATUS_ACTIVE));

            $result = $result->queryRow();

            if(!empty($result)&&$result['url_path']===$matches[0])

            {

                $_GET['nice_url']=$result['url_path'];

                return 'page/index';

            }

        }

        return false;  // this rule does not apply

    }

}



Now everything works as expected, the only issue is that even though i set up a “.html” suffix for my urls, the urls generated by this custom class don’t have that suffix.

Anyone knows a fix for this ?