Query Builder and Query
How to include Query class in controller (Yii 2.0)
$query = new Query;
// Define the query:
$query->select('id, name')
->from('tbl_user')
->limit(10);
Query Builder and Query
How to include Query class in controller (Yii 2.0)
$query = new Query;
// Define the query:
$query->select('id, name')
->from('tbl_user')
->limit(10);
you have to import the query class into your controllers namespace.
http://www.php.net/manual/en/language.namespaces.importing.php
Add the following code to your controller class file after the namespace line:
use yii\db\Query;
Thank you CeBe.