I'm developing the phpdaemon script using the Phalcon's ORM and models.
It initializes all DB objects in the init routines and then runs 'forever'. In the meanwhile the MySQL connection might lost getting the following error:
Uncaught PDOException (HY000): SQLSTATE[HY000]: General error: 2006 MySQL server has gone away. 0 [internal function]: PDOStatement->execute() 1 [internal function]: Phalcon\Db\Adapter\Pdo->executePrepared(Object(PDOStatement), Array, NULL) ... etc etc ...
The question is how to determine if there is no connection and how to reconnect it?