public function __destruct() { // query whether we've a wrapped instance if ($wrapped = $this->getWrapped()) { $wrapped->getConnection()->close(); } }