Код: Выделить всё
/**
* This is the model class for table "test".
*
* @property integer $id
* @property string $string
* @property integer $number
*/
class Test extends \yii\db\ActiveRecord
{
public static function tableName()
{
return 'test';
}
public function rules()
{
return [
[['number'], 'integer'],
[['string'], 'string', 'max' => 100]
];
}
public function afterSave($insert, $changedAttributes)
{
echo "<pre>";
var_dump($changedAttributes);
var_dump($this->attributes);
var_dump($this->oldAttributes);
echo "</pre>";
exit;
parent::afterSave($insert, $changedAttributes);
}
}
Код: Выделить всё
array(1) {
["number"]=>
int(1)
}
array(3) {
["id"]=>
int(1)
["string"]=>
string(4) "test"
["number"]=>
string(1) "1"
}
array(3) {
["id"]=>
int(1)
["string"]=>
string(4) "test"
["number"]=>
string(1) "1"
}