Answer the question
In order to leave comments, you need to log in
Why might ActiveController not work in Yii2?
There is a model:
namespace app\models;
use yii\db\ActiveRecord;
class Book extends ActiveRecord
{
public static function tableName()
{
return 'book';
}
public static function primaryKey()
{
return ['id'];
}
public function getAuthor()
{
return $this->hasOne(Author::className(), ['id' => 'author_id']);
}
}
namespace app\controllers;
use yii\rest\ActiveController;
class BookController extends ActiveController
{
public $modelClass = 'app\models\Book';
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question