После сохранения модели в $changedAttributes есть не измененные атрибуты.
В rules модели stock_id - Int, status - int
Почему в changedAttributes есть stock_id котороые не изменен? Подозреваю что из-за стринга но почему переменная в аттрибутах которая Int в _attributes и _oldAttributes строка?
В какой момент int становится строкой?
Код: Выделить всё
object(yii\db\AfterSaveEvent)#211 (5) {
["changedAttributes"]=>
array(5) {
["name"]=>
string(1) "1"
["stock_id"]=>
int(6)
["comment"]=>
string(3) "123"
["status"]=>
int(10)
["updated_at"]=>
int(1564660839)
}
["name"]=> string(11) "afterUpdate"
["sender"]=>
object(common\models\secret\Secret)#155 (10) {
["_attributes":"yii\db\BaseActiveRecord":private]=>
array(11) {
["id"]=>
int(27)
["name"]=>
string(3) "123"
["stock_id"]=>
string(1) "6"
["date"]=>
int(1566345600)
["comment"]=>
string(4) "1234"
["status"]=>
string(2) "10"
["created_at"]=>
int(1564660839)
["updated_at"]=>
int(1565352014)
}
["_oldAttributes":"yii\db\BaseActiveRecord":private]=>
array(11) {
["id"]=>
int(27)
["name"]=>
string(3) "123"
["stock_id"]=>
string(1) "6"
["date"]=>
int(1566345600)
["comment"]=>
string(4) "1234"
["status"]=>
string(2) "10"
["created_at"]=>
int(1564660839)
["updated_at"]=>
int(1565352014)
}