You are here

protected function GroupwiseMax::conditionNamespace in Drupal 9

Same name and namespace in other branches
  1. 8 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 324

Class

GroupwiseMax
Relationship handler that allows a groupwise maximum of the linked in table. For a definition, see: http://dev.mysql.com/doc/refman/5.0/en/example-maximum-column-group-row.... In lay terms, instead of joining to get all matching records in the…

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);
}