/** * Format the route and params as a url path * Save the result to a local cache so we're only looking this up once per model type * @return string */ public function getPathFormat() { if ( $this->_pathFormat === null ) { $routeParams= array(); foreach( $this->params as $key=>$attribute ) { $routeParams[ $key ] = $this->formatParam( $attribute ); } $this->_pathFormat = Controller::absoluteUrl($this->route, $routeParams); // NOTE +++++++++++++ // When unit testing, if you don't have a SERVER_NAME defined, the // absolute url will fail, so toggle this on instead if including that test //$this->_pathFormat = Yii::app()->createUrl($this->route, $routeParams); } return $this->_pathFormat; }