I am trying to build a query using raw SQL. I want the query to be returned as complex Resultset, how to do it?
use use Phalcon\Mvc\Model\Resultset\Complex as Resultset;
$rowSql = 'SELECT
DISTINCT i.car_id
FROM cars AS i
LEFT JOIN
(some sql..)
AS e ON (e.car_id = i.car_id)
WHERE
i.source_id = 2
AND e.car IS NULL LIMIT 180;';
$model = new Cars();
$result = new Resultset([
'HOW THIS ARRAY SHOULD LOOK LIKE?',
], $model->getReadConnection()->query($rowSql));
I don't know how first argument of Resultset\Complex
constructor should look like? It's array $columnTypes
.
TIA!