You are here

public function Sql::placeholder in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/src/Plugin/views/query/Sql.php \Drupal\views\Plugin\views\query\Sql::placeholder()

Generates a unique placeholder used in the db query.

File

core/modules/views/src/Plugin/views/query/Sql.php, line 1087

Class

Sql
Views query plugin for an SQL query.

Namespace

Drupal\views\Plugin\views\query

Code

public function placeholder($base = 'views') {
  static $placeholders = [];
  if (!isset($placeholders[$base])) {
    $placeholders[$base] = 0;
    return ':' . $base;
  }
  else {
    return ':' . $base . ++$placeholders[$base];
  }
}