/** * @param string $entityType * @throws \Exception * @return void */ public function process($entityType) { $metadata = $this->metadataPool->getMetadata($entityType); $connection = $metadata->getEntityConnection(); $hash = spl_object_hash($connection); if ($connection->getTransactionLevel() === 0) { $callbacks = CallbackPool::get($hash); try { foreach ($callbacks as $callback) { call_user_func($callback); } } catch (\Exception $e) { $this->logger->error($e->getMessage(), $e->getTrace()); throw $e; } } }
/** * Commit resource transaction * * @return $this * @api */ public function commit() { $this->getConnection()->commit(); /** * Process after commit callbacks */ if ($this->getConnection()->getTransactionLevel() === 0) { $callbacks = CallbackPool::get(spl_object_hash($this->getConnection())); try { foreach ($callbacks as $callback) { call_user_func($callback); } } catch (\Exception $e) { throw $e; } } return $this; }