We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

phql is not run,raw sql is run, why?

   $res = $this->db->fetchOne('select * from products');
    echo "<pre>";
    var_dump($res);
    echo "</pre>";
    $query = new Query(
        "SELECT * FROM Products",
        $this->getDI()
    );
    $products = $query->execute();
    echo "<pre>";
    var_dump(count($products));
    echo "</pre>";

What is the problem? Does it exit with an error? Is the count of $products zero?

Also, do you have a PHP Products class extending Phalcon\Model and autoloded?

edited Oct '16

What you mean is not run ? Check php logs. Also add mysql logging(from mysql or framework on beforeQuery).