Hello, I’m still very new to Yii2 and hangel me of Tutorial to Tutorial. Now I have a problem with the search within a relational DB.
Source: http: //www.yiiframew…idview-yii-2-0/
Based on this statement I have created and linked my database and its tables.
It all works except for the search function here I get follow error border:
Calling unknown method: app \ models \ TxeventSearch :: addCondition ()
The method, however, is stored and I just do not understand why he can not use it. Have already made so that you experience.
Sorry if the question is ridiculous for one or the other appears, but I just can not find a solution.
- in /yyy/models/TxeventSearch.php – yii\base\Component::__call(‘addCondition’, [yii\db\ActiveQuery, ‘id’]) at line 118
$query->joinWith([‘tx’]);
return $dataProvider;
}
//----- START ------
118 $this->addCondition($query, ‘id’);
$this->addCondition($query, ‘uniquenumber’);
$this->addCondition($query, ‘shortnumber’);
- in /yyy/models/TxeventSearch.php – app\models\TxeventSearch::addCondition(yii\db\ActiveQuery, ‘id’) at line 118
$query->joinWith([‘tx’]);
return $dataProvider;
}
//----- START ------
$this->addCondition($query, ‘id’);
118 $this->addCondition($query, ‘uniquenumber’);
- in /var/www/yii/dev_dashboard/controllers/TxeventController.php – app\models\TxeventSearch::search([‘TxeventSearch’ => [‘id’ => ‘’, ‘uniquenumber’ => ‘’, ‘shortnumber’ => ‘’, ‘reference_uniquenumber’ => ‘’, …], ‘r’ => ‘txevent/index’, ‘sort’ => ‘id’]) at line 36
-
Lists all Txevent models.
-
@return mixed
*/
public function actionIndex()
{
$searchModel = new TxeventSearch();
36 $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render(‘index’, [
‘searchModel’ => $searchModel,
‘dataProvider’ => $dataProvider,
]);
}
-
app\controllers\TxeventController::actionIndex()
-
in yyy/vendor/yiisoft/yii2/base/InlineAction.php – call_user_func_array([app\controllers\TxeventController, ‘actionIndex’], []) at line 55
-
in yyy/vendor/yiisoft/yii2/base/Controller.php – yii\base\InlineAction::runWithParams([‘TxeventSearch’ => [‘id’ => ‘’, ‘uniquenumber’ => ‘’, ‘shortnumber’ => ‘’, ‘reference_uniquenumber’ => ‘’, …], ‘r’ => ‘txevent/index’, ‘sort’ => ‘id’]) at line 150
-
yyy/vendor/yiisoft/yii2/base/Module.php – yii\base\Controller::runAction(‘index’, [‘TxeventSearch’ => [‘id’ => ‘’, ‘uniquenumber’ => ‘’, ‘shortnumber’ => ‘’, ‘reference_uniquenumber’ => ‘’, …], ‘r’ => ‘txevent/index’, ‘sort’ => ‘id’]) at line 462
-
in yyy/vendor/yiisoft/yii2/web/Application.php – yii\base\Module::runAction(‘txevent/index’, [‘TxeventSearch’ => [‘id’ => ‘’, ‘uniquenumber’ => ‘’, ‘shortnumber’ => ‘’, ‘reference_uniquenumber’ => ‘’, …], ‘r’ => ‘txevent/index’, ‘sort’ => ‘id’]) at line 83
-
in yyy/vendor/yiisoft/yii2/base/Application.php – yii\web\Application::handleRequest(yii\web\Request) at line 371
-
in /var/www/yii/dev_dashboard/web/index.php – yii\base\Application::run() at line 12
6789101112
require(DIR . ‘/../vendor/autoload.php’);
require(DIR . ‘/../vendor/yiisoft/yii2/Yii.php’);
$config = require(DIR . ‘/../config/web.php’);
12 (new yii\web\Application($config))->run();