Answer the question
In order to leave comments, you need to log in
Yii\rest\ActiveController does not work with large tables. Why?
Hello, I ran into a problem, when creating a RESTful API based on Yii2, the yii\rest\ActiveController class refuses to work with large tables, but it works fine with trial tables. Why and how to solve it?
UserController.php
<?php
namespace backend\controllers;
use backend\models\User;
use yii\rest\ActiveController;
class UserController extends ActiveController
{
public $modelClass = 'backend\models\User';
}
'urlManager' => [
'enablePrettyUrl' => true,
'enableStrictParsing' => true,
'showScriptName' => false,
'rules' => [
[
'class' => 'yii\rest\UrlRule',
'controller' => 'user',
],
],
],
<?php
namespace backend\models;
use yii\db\ActiveRecord;
/**
* User model
*
* Table: user
*/
class User extends ActiveRecord
{
public static function tableName()
{
return '{{users}}';
}
}
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