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;
  }
}
doc_Drupal
2016-10-29 09:41:38
Comments
Leave a Comment

Please login to continue.