Hi everyone. I want to suggest something.
should we implement something like this to default framework?
This would be AR’s default view link
//generates url to unit by unit_id or slug
public function url($array=array())
{
if($this->slug!=null)
return Yii::app()->controller->createUrl('//unit/'.$this->slug,$array);
else
return Yii::app()->controller->createUrl('//unit/unit/view',array('id'=>$this->unit_id,$array));
}
//generates url array
public function urlParams($action,$array=array())
{
if($this->slug!=null)
return array($action, 'id'=>$this->slug,$array);
else
return array($action, 'id'=>$this->unit_id,$array);
}
In this case we can modify any view without write more.
Just $model->url() or $model->url($options) something like this. And many other default widgets if support this, it would be extremely useful I think.