/** * Adapter constructor * * @param array $config */ public function __construct($config) { $phql = $config['phql']; $bind = $config['bind']; $page = $config['page']; $limit = $config['limit']; $phql .= " LIMIT {$limit} OFFSET " . ($page - 1) * $limit; $query = new \Phalcon\Mvc\Model\Query($phql); $query->setDI($config['di']); $this->data = $query->execute($bind); }
<?php // Instantiate the Query $query = new Phalcon\Mvc\Model\Query("SELECT * FROM Cars"); // Pass the DI container $query->setDI($di); // Execute the query returning a result if any $cars = $query->execute();