You are here

public static function QueryBase::getNamespaces in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Entity/Query/QueryBase.php \Drupal\Core\Entity\Query\QueryBase::getNamespaces()

Gets a list of namespaces of the ancestors of a class.

Parameters

$object: An object within a namespace.

Return value

array A list containing the namespace of the class, the namespace of the parent of the class and so on and so on.

3 calls to QueryBase::getNamespaces()
QueryFactory::__construct in core/lib/Drupal/Core/Config/Entity/Query/QueryFactory.php
Constructs a QueryFactory object.
QueryFactory::__construct in core/lib/Drupal/Core/Entity/Query/Sql/QueryFactory.php
Constructs a QueryFactory object.
QueryFactory::__construct in core/lib/Drupal/Core/Entity/Query/Null/QueryFactory.php
Constructs a QueryFactory object.

File

core/lib/Drupal/Core/Entity/Query/QueryBase.php, line 463
Contains \Drupal\Core\Entity\Query\QueryBase.

Class

QueryBase
The base entity query class.

Namespace

Drupal\Core\Entity\Query

Code

public static function getNamespaces($object) {
  $namespaces = array();
  for ($class = get_class($object); $class; $class = get_parent_class($class)) {
    $namespaces[] = substr($class, 0, strrpos($class, '\\'));
  }
  return $namespaces;
}