Hello, thank you very much for the help raised, of course help is always welcome and brings new knowledge, for which I thank you infinitely.
I had thought about this option, however it also generates an error, which I dismissed it, since the code that I placed before is the generator for the Gii module, which for me had more weight when deciding which one to continue fighting with. .
In none of the screens change the extension options or anything similar. I generated the crud with the default values, including the class and file names to avoid inconvenience.
I followed his recommendation, obtaining in this case a new error which I attached below:
ArgumentCountError
Too few arguments to function yii\db\ActiveQuery::__construct(), 0 passed in /var/www/ovsp/controllers/UsuariosController.php on line 38 and at least 1 expected
1. in /var/www/ovsp/vendor/yiisoft/yii2/db/ActiveQuery.php at line 107
*/
public $joinWith;
/**
* Constructor.
* param string $modelClass the model class associated with this query
* param array $config configurations to be applied to the newly created query object
*/
public function __construct($modelClass, $config = [])
{
$this->modelClass = $modelClass;
parent::__construct($config);
}
/**
* Initializes the object.
* This method is called at the end of the constructor. The default implementation will trigger
* an [[EVENT_INIT]] event. If you override this method, make sure you call the parent implementation at the end
2. in /var/www/ovsp/controllers/UsuariosController.php at line 38 – yii\db\ActiveQuery::__construct()
/**
* Lists all SistemaUsuarios models.
* return mixed
*/
public function actionIndex()
{
$searchModel = new SistemaUsuariosQuery();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
3. app\controllers\UsuariosController::actionIndex()
4. in /var/www/ovsp/vendor/yiisoft/yii2/base/InlineAction.php at line 57 – call_user_func_array([app\controllers\UsuariosController, 'actionIndex'], [])
5. in /var/www/ovsp/vendor/yiisoft/yii2/base/Controller.php at line 180 – yii\base\InlineAction::runWithParams(['r' => 'usuarios'])
6. in /var/www/ovsp/vendor/yiisoft/yii2/base/Module.php at line 528 – yii\base\Controller::runAction('', ['r' => 'usuarios'])
7. in /var/www/ovsp/vendor/yiisoft/yii2/web/Application.php at line 103 – yii\base\Module::runAction('usuarios', ['r' => 'usuarios'])
8. in /var/www/ovsp/vendor/yiisoft/yii2/base/Application.php at line 386 – yii\web\Application::handleRequest(yii\web\Request)
9. in /var/www/ovsp/web/index.php at line 12 – yii\base\Application::run()
require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/../vendor/yiisoft/yii2/Yii.php';
$config = require __DIR__ . '/../config/web.php';
(new yii\web\Application($config))->run();
The code of my class was this way:
namespace app\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use yii\db\ActiveQuery;
use app\models\SistemaUsuarios;
/**
- SistemaUsuariosQuery represents the model behind the search form of
app\models\SistemaUsuarios
.
/
class SistemaUsuariosQuery extends ActiveQuery
{
/*
- {inheritdoc}
*/
public function rules()
{
return [
Thank you very much for the help you can give me and I apologize for the inconvenience.