Thanks in advance for your help.
I'm wondering if anyone quickly knows what functions to call on the Entity Repository to jog its reconnection if it is dead. I am running some jobs that can take a length of time that exceeds wait_timeout through a ZF2 CLI route, and unfortunately, the ER's connection dies by the time it needs to get used (when the job is done).
Need:
// do the long job
$sl = $this->getServiceLocator();
$mapper = $sl->get( 'doctrine_object_mapper' );
if( !$mapper->getRepository()->isAlive() ) // something like so
$mapper->getRepository()->wakeTheHellUp();
Aren't those proper method names! ;)
Thanks again.
This is a fairly common problem with long running processes and connections.
The solution is to retrieve the ORM's DBAL connection and re-create it if the connection was lost (ensuring it didn't die during a transaction). This is obviously annoying, but it's the only way of doing it right now: