I'm using the CakePHP ORM package inside a Gearman Worker. Package : https://packagist.org/packages/cakephp/orm
$connectionObject = ConnectionManager::get('Backend');
$usersTable = TableRegistry::get('Users', ['connection' => $connectionObject]);
$countActiveUsers = $usersTable->find()->where(['active' => 1])->count();
I'm trying to find a way to disconnect the database when a job finish to be processed because now, even if there is no job in the queue, the connection between the worker and the database remains open.
Thanks in advance!