You are here

public static function QueryBase::getNamespaces in Drupal 9

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

5 calls to QueryBase::getNamespaces()
PgsqlQueryFactory::__construct in core/modules/workspaces/src/EntityQuery/PgsqlQueryFactory.php
Constructs a PgsqlQueryFactory object.
QueryFactory::__construct in core/modules/workspaces/src/EntityQuery/QueryFactory.php
Constructs a QueryFactory object.
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 473

Class

QueryBase
The base entity query class.

Namespace

Drupal\Core\Entity\Query

Code

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