function __destruct() { if ($this->db->inTransaction() && is_resource($this->db->getLink())) { $this->closeCursor(); $this->closeTransaction(); } }
protected function getLink() { if (!$this->db) { throw new WrongStateException('Expected setted db'); } if (!$this->db->isConnected()) { $this->db->connect(); } return $this->db->getLink(); }