/** * Connects to a database. * @return void */ public final function connect() { if ($this->profiler !== NULL) { $ticket = $this->profiler->before($this, IDibiProfiler::CONNECT); } $this->driver->connect($this->config); $this->connected = TRUE; if (isset($ticket)) { $this->profiler->after($ticket); } }
/** * Connects to a database. * @return void */ public final function connect() { $event = $this->onEvent ? new DibiEvent($this, DibiEvent::CONNECT) : NULL; try { $this->driver->connect($this->config); $this->connected = TRUE; $event && $this->onEvent($event->done()); } catch (DibiException $e) { $event && $this->onEvent($event->done($e)); throw $e; } }