title: CakePHP ORM :: Disconnect database
body: <p>I'm using the CakePHP ORM package inside a Gearman Worker.
  Package : <a href="https://packagist.org/packages/cakephp/orm" rel="nofollow">https://packagist.org/packages/cakephp/orm</a></p>
  
  <pre><code>$connectionObject = ConnectionManager::get('Backend');
  $usersTable = TableRegistry::get('Users', ['connection' =&gt; $connectionObject]);
  $countActiveUsers = $usersTable-&gt;find()-&gt;where(['active' =&gt; 1])-&gt;count();
  </code></pre>
  
  <p>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.</p>
  
  <p>Thanks in advance!</p>