0
가상 속성은 모델을 나타낼 수 있습니까? 이 wiki을 읽었지만 대답을 찾지 못했습니다.Yii 가상 속성 및 모델
편집 : 목표는 내 모델을 사용자에게보다 명확하게 만드는 것입니다.
abstract class BaseDonnee{
protected $info;
public function representingColumn(){
return 'info'; //Please, I'm not sure this is right
}
public function setInfo(){
//I can set the attribute's value
$this->info = Info::model()->find('a condition')->info;
}
public function getInfo(){
return $this->info;
}
}
편집 2 : 코드를 실행할 때, 나는 예외 얻을 수 있습니다 :
CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: [Microsoft][SQL Server Native Client 11.0][SQL Server]Nom de colonne non valide : 'info'..
내가 일을 그것을 어떻게 진행할 수 있습니까?
내가 볼 수 있습니다. 그러나 유사한 코드를 만들 때 내 특성이 없다고 가정하면 예외가 발생할 수 있습니다. 'CDbCommand가 SQL 문을 실행하지 못했습니다. SQLSTATE [42S22] : [Microsoft] [SQL Server Native Client 11.0] [SQL Server] Nom de colonne non valide : 'info'.. '내 질문을 내 템플릿으로 업데이트해야한다고 생각합니다. – sk001
질문에이 오류를 추가해도 좋을 것입니다. –