W3cubDocs

/Drupal 8

public function SelectExtender::__call

public SelectExtender::__call($method, $args)

Magic override for undefined methods.

If one extender extends another extender, then methods in the inner extender will not be exposed on the outer extender. That's because we cannot know in advance what those methods will be, so we cannot provide wrapping implementations as we do above. Instead, we use this slower catch-all method to handle any additional methods.

File

core/lib/Drupal/Core/Database/Query/SelectExtender.php, line 499

Class

SelectExtender
The base extender class for Select queries.

Namespace

Drupal\Core\Database\Query

Code

public function __call($method, $args) {
  $return = call_user_func_array(array($this->query, $method), $args);

  // Some methods will return the called object as part of a fluent interface.
  // Others will return some useful value.  If it's a value, then the caller
  // probably wants that value.  If it's the called object, then we instead
  // return this object.  That way we don't "lose" an extender layer when
  // chaining methods together.
  if ($return instanceof SelectInterface) {
    return $this;
  }
  else {
    return $return;
  }
}

© 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!Query!SelectExtender.php/function/SelectExtender::__call/8.1.x