You are here

public function HierarchyOutlineStorage::hierarchyGetParent in Entity Reference Hierarchy 8

Get the immediate parent for the given node.

File

src/HierarchyOutlineStorage.php, line 72
Definition of Drupal\entity_hierarchy\HierarchyOutlineStorage.

Class

HierarchyOutlineStorage
Defines a storage class for hierarchies outline.

Namespace

Drupal\entity_hierarchy

Code

public function hierarchyGetParent($cnid) {
  $query = db_select('entity_hierarchy', 'nh')
    ->fields('nh')
    ->where('cnid = :cnid', array(
    ':cnid' => $cnid,
  ))
    ->orderBy('pweight', 'ASC');
  $result = $query
    ->execute()
    ->fetch();
  return $result;
}