Возможно ли динамически создать контроллер и подключить его к приложению?
т.е.
Код: Выделить всё
<?php
namespace some\module;
use Yii;
use yii\web\Controller;
class TestController extends Controller
{
/**
* @inheritdoc
*/
public function actions()
{
return [
'some' => [
'class' => SomeAction::class,
'modelClass' => SomeeModel::class,
],
];
}
}
Код: Выделить всё
$controller = new TestController('test', Yii::$app, []);
Yii::$app->controller = $controller;
Код: Выделить всё
$I->sendAjaxPostRequest(['test/some'], ['id' => $this->_model->id]);
Unable to resolve the request "test/toggle"
UPD. Протестировать нужно action в модуле.