Документация: https://github.com/yiisoft/yii2/blob/ma ... ponse-data
Делаю http://localhost/users?fields=id&expand=pipings
не возвращается
Код: Выделить всё
"pipings": {
...
}
Код: Выделить всё
public function getPipings()
{
return $this->hasMany(Piping::className(), ['sector_id' => 'id']);
}
Код: Выделить всё
public function fields()
{
return [
// field name is the same as the attribute name
'id',
'pipings' => function () {
return $this->getPipings();
},
];
}
Есть идеи?