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

Transactions in PHQL

I just a have a question. Is it possible to do transactions with PHQL?



98.9k
Accepted
answer

Yes, you can:

$this->db->begin();

$this->manager->executeQuery("INSERT INTO Cars VALUES (NULL, 'Lamborghini Espada', 7, 10000.00, 1969, 'Grand Tourer')");
$this->manager->executeQuery("INSERT INTO Cars VALUES (NULL, 'Lamborghini Espada', 7, 10000.00, 1969, 'Grand Tourer')");
$this->manager->executeQuery("INSERT INTO Cars VALUES (NULL, 'Lamborghini Espada', 7, 10000.00, 1969, 'Grand Tourer')");

$this->db->commit();