/** * Begins a transaction (if supported). * @param string optional savepoint name * @return void */ public function begin($savepoint = NULL) { $this->connected || $this->connect(); if ($this->profiler !== NULL) { $ticket = $this->profiler->before($this, IDibiProfiler::BEGIN, $savepoint); } $this->driver->begin($savepoint); if (isset($ticket)) { $this->profiler->after($ticket); } }
/** * Begins a transaction (if supported). * @param string optional savepoint name * @return void */ public function begin($savepoint = NULL) { $this->connected || $this->connect(); $event = $this->onEvent ? new DibiEvent($this, DibiEvent::BEGIN, $savepoint) : NULL; try { $this->driver->begin($savepoint); $event && $this->onEvent($event->done()); } catch (DibiException $e) { $event && $this->onEvent($event->done($e)); throw $e; } }