Hi guys, i'd searched on forum but there is only old answers, and unreliable ones.
How can I get the last SQL executed on Phalcon 4?
Thanks
its still the same with phalcon 4
check the API documentaion
check this answer here also
$phql = 'UPDATE `news` SET `category_id` = 5 WHERE `id` = :id'; $this->db->execute($phql, ['id' => 1]); print_r($this->db->getSQLStatement()); print_r($this->db->getSqlVariables()); News::findFirst(); print_r($this->db->getSQLStatement()); print_r($this->db->getSqlVariables());
and i would recommend checking the class Phalcon\Db\Profiler
Phalcon\Db\Profiler