function GroupwiseMax::conditionNamespace

Same name in other branches
  1. 8.9.x core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php \Drupal\views\Plugin\views\relationship\GroupwiseMax::conditionNamespace()
  2. 10 core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php \Drupal\views\Plugin\views\relationship\GroupwiseMax::conditionNamespace()
  3. 11.x core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php \Drupal\views\Plugin\views\relationship\GroupwiseMax::conditionNamespace()

Helper function to namespace query pieces.

Turns 'foo.bar' into '"foo_NAMESPACE".bar'. PostgreSQL doesn't support mixed-cased identifiers unless quoted, so we need to quote each single part to prevent from query exceptions.

2 calls to GroupwiseMax::conditionNamespace()
GroupwiseMax::alterSubqueryCondition in core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php
Recursive helper to add a namespace to conditions.
GroupwiseMax::leftQuery in core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php
Generate a subquery given the user options, as set in the options.

File

core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php, line 326

Class

GroupwiseMax
The relationship handler for groupwise maximum queries.

Namespace

Drupal\views\Plugin\views\relationship

Code

protected function conditionNamespace($string) {
    $parts = explode(' = ', $string);
    foreach ($parts as &$part) {
        if (strpos($part, '.') !== FALSE) {
            $part = '"' . str_replace('.', $this->subquery_namespace . '".', $part);
        }
    }
    return implode(' = ', $parts);
}

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