function Connection::tablePrefix

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::tablePrefix()
  2. 8.9.x core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::tablePrefix()

Find the prefix for a table.

This function is for when you want to know the prefix of a table. This is not used in prefixTables due to performance reasons.

Parameters

string $table: (optional) The table to find the prefix for.

Deprecated

in drupal:10.1.0 and is removed from drupal:11.0.0. Instead, you should just use Connection::getPrefix().

See also

https://www.drupal.org/node/3260849

File

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

Class

Connection
Base Database API class.

Namespace

Drupal\Core\Database

Code

public function tablePrefix($table = 'default') {
    @trigger_error(__METHOD__ . '() is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Instead, you should just use Connection::getPrefix(). See https://www.drupal.org/node/3260849', E_USER_DEPRECATED);
    return $this->prefix;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.