Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
In Craft 2 you could creat a query with:
craft()->db->createCommand()->select() .... etc.
But in Craft 3 there is no select() Method in Craft::$app->db->createCommand().
Am I overlooking something?
You can use either an activeRecord for it
$customer = Customer::find()
->where(['id' => 123])
Or a query
$rows = (new \craft\db\Query())
->where(['last_name' => 'Smith'])
return $this->renderTemplate('path/to/template' ['data' => $rows])
return $this->asJson(['data' => $rows]);
Required, but never shown