W3cubDocs

/Drupal 8

public function Connection::setTarget

public Connection::setTarget($target = NULL)

Tells this connection object what its target value is.

This is needed for logging and auditing. It's sloppy to do in the constructor because the constructor for child classes has a different signature. We therefore also ensure that this function is only ever called once.

Parameters

string $target: (optional) The target this connection is for.

File

core/lib/Drupal/Core/Database/Connection.php, line 403

Class

Connection
Base Database API class.

Namespace

Drupal\Core\Database

Code

public function setTarget($target = NULL) {
  if (!isset($this->target)) {
    $this->target = $target;
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Database!Connection.php/function/Connection::setTarget/8.1.x