public function HierarchyOutlineStorage::insert in Entity Reference Hierarchy 8
Inserts a hierarchy link.
Parameters
object $item (TODo: change to array): The link object to be inserted in the database.
array $parents: The array of parent ids for the link to be inserted.
Return value
mixed The last insert ID of the query, if one exists.
Overrides HierarchyOutlineStorageInterface::insert
File
- src/
HierarchyOutlineStorage.php, line 128 - Definition of Drupal\entity_hierarchy\HierarchyOutlineStorage.
Class
- HierarchyOutlineStorage
- Defines a storage class for hierarchies outline.
Namespace
Drupal\entity_hierarchyCode
public function insert($item) {
return $this->connection
->insert('entity_hierarchy')
->fields(array(
'pnid' => $item->pnid,
'cnid' => $item->cnid,
'cweight' => $item->cweight,
'pweight' => $item->pweight,
))
->execute();
}