私は Yii を初めて使用し、小さな問題を抱えていますが、それを理解することはできません。問題は、私のモデル (アクティブなレコード) の 1 つで Yii を呼び出したときです。 $this->attributes = 'something'; 「プロパティ "SiteController.attributes" が定義されていません」というエラーが表示されます。
私はこれをコントローラーに持っています:
public function actionIndex()
{
// Create new clients active record
$client = new Clients;
// Check if user send some request
if (isSet($_POST)){
switch($_POST["action"]){
case 'newClient':
$registered = $client::addClient($_POST);
}
}
// render the view
$this->render('landing',array(
// Objects
'client' => $client,
// Variables
'registered' => $registered,
));
return true;
}
そしてこれはモデルで:
public function addClient($data){
// Set data
$this->attributes = $data["Clients"];
$this->password = self::generatePassword(6);
// Proceed
$this->setScenario('insert');
return true;
}
もちろん、機能は完全ではありませんが、ここでエラーが発生します。私が間違っているのは正確には何ですか?ありがとうございました