I have installed Netbenas, XAMPP, xdebug and Yii2 and I have simple REST controller:
<?php
namespace app\controllers;
use yii\rest\ActiveController;
class ContractController extends ActiveController
{
public $modelClass = 'app\models\Contract';
}
which connects to the Firebird 2.1 database (WIN1257) and gives error:
error on line 2 at column 431: Encoding error
I want to debug this error to determine how can I improve Yii-Firebird plugin but where can I put breakpoint if this controller has no action (action from base class is used). In run congfiguration I have Project URL:
http://localhost:8081/myproject/
and index file:
web/index.php
My intention was to put here url that gives error:
http://localhost:8081/myproject/web/index.php/contract
But Netbeans does not accept /contract part in index file field.
So - which file should I open in Netbenas and how to indicate that I want to debug url http://localhost:8081/myproject/web/index.php/contract?
Your
class ContractController extends ActiveController
is an extension of ActiveController
So you could place your breakpoint to the proper ActiveController action ..
in
vendor/yiisoft/yii2/rest/ActionController
you can find
public function actions()
{
return [
'index' => [
'class' => 'yii\rest\IndexAction',
'modelClass' => $this->modelClass,
'checkAccess' => [$this, 'checkAccess'],
],
'view' => [
'class' => 'yii\rest\ViewAction',
'modelClass' => $this->modelClass,
'checkAccess' => [$this, 'checkAccess'],
],
'create' => [
'class' => 'yii\rest\CreateAction',
'modelClass' => $this->modelClass,
'checkAccess' => [$this, 'checkAccess'],
'scenario' => $this->createScenario,
],
'update' => [
'class' => 'yii\rest\UpdateAction',
'modelClass' => $this->modelClass,
'checkAccess' => [$this, 'checkAccess'],
'scenario' => $this->updateScenario,
],
'delete' => [
'class' => 'yii\rest\DeleteAction',
'modelClass' => $this->modelClass,
'checkAccess' => [$this, 'checkAccess'],
],
'options' => [
'class' => 'yii\rest\OptionsAction',
],
];
}
where you can see that for each action you have a proper class eg:..
'class' => 'yii\rest\IndexAction',
In the same dir vendor/yiisoft/yii2/rest/ActionController
you can find the class code
Then you could place the breakpoint on the related class run function
public function run()
{
if ($this->checkAccess) {
call_user_func($this->checkAccess, $this->id);
}
return $this->prepareDataProvider();
}