I have sintaks in model like this
/**
* This is the model class for table "{{regional}}".
*
* The followings are the available columns in table '{{regional}}':
* @property integer $id
* @property string $regional_cd
* @property string $regional_nm
* @property string $pro_cd
* @property string $kab_cd
* @property string $kec_cd
* @property string $kel_cd
* @property string $status_cd
* @property string $old_nm
* @property integer $active
*/
public function getFulladdress()
{
$address='';
$prop = substr($this->regional_cd,0,2)."00000000";
$kab = substr($this->regional_cd,0,4)."000000";
$kec = substr($this->regional_cd,0,7)."000";
if((int)$this->kel_cd > 0 )
{
$address.='Kel. '.$this->regional_nm;
}
if((int)$this->kec_cd > 0)
{
$models=$this->model()->findAll(array(
'condition'=>'regional_cd=:propCd',
'params'=>array(':propCd'=>$kec),
));
foreach($models as $model)
{
if((int)$this->kel_cd > 0)
$address.=', Kec. '.$model->regional_nm;
else
$address.='Kec. '.$model->regional_nm;
}
}
if((int)$this->kab_cd > 0)
{
$models=$this->model()->findAll(array(
'condition'=>'regional_cd=:propCd',
'params'=>array(':propCd'=>$kab),
));
foreach($models as $model)
{
if((int)$this->kec_cd > 0)
$address.=', Kab. '.$model->regional_nm;
else
$address.='Kab. '.$model->regional_nm;
}
}
if((int)$this->pro_cd > 0)
{
$models=$this->model()->findAll(array(
'condition'=>'regional_cd=:propCd',
'params'=>array(':propCd'=>$prop),
));
foreach($models as $model)
{
if((int)$this->kab_cd > 0)
$address.=', Prop. '.$model->regional_nm;
else
$address.='Prop. '.$model->regional_nm;
}
}
return $address;
}
the problem that code become slow execute in browser, please help me to speed up to execute that code …