@trigger_error(__METHOD__.'() is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. Move custom database destruction logic to __destruct(). See https://www.drupal.org/node/3142866',E_USER_DEPRECATED);
// Destroy all references to this connection by setting them to NULL.
// The Statement class attribute only accepts a new value that presents a
// proper callable, so we reset it to PDOStatement.
@@ -268,6 +276,22 @@ public function destroy() {
}
$this->schema=NULL;
}
}
/**
* Ensures that the PDO connection can be garbage collected.
*/
publicfunction__destruct(){
// Call the ::destroy method to provide a BC layer.
// @todo https://www.drupal.org/project/drupal/issues/3153864 Remove this
// call in Drupal 10 as the logic in the destroy() method is no longer
// required now we implement a proper destructor.
$this->destroy();
// Ensure that the circular reference caused by Connection::__construct()
// using $this in the call to set the statement class can be garbage
// collected.
$this->connection=NULL;
}
/**
* Returns the default query options for any given query.