Yii2 REST create with fields()
问题 Let's say that I had the following API set up: Controller: <?php namespace app\modules\v1\controllers; use yii; class ResourceController extends \yii\rest\ActiveController { public $modelClass = 'app\modules\v1\models\Resource'; } Model: use yii; class Resource extends \yii\db\ActiveRecord { public static function tableName() { return 'ResourceTable'; } public function fields() { return [ 'id' => 'ResourceID', 'title' => 'ResourceTitle', ]; } } where my table only has the two columns,