You are here

public function EntityDependencyIterator::getChildrenEntities in Entity Dependency API 7

Helper method to get entity dependencies.

1 call to EntityDependencyIterator::getChildrenEntities()
EntityDependencyIterator::getChildren in ./EntityDependencyIterator.inc
Returns an iterator for the current entry.

File

./EntityDependencyIterator.inc, line 198
Entity Dependency classes.

Class

EntityDependencyIterator
Iterator class which does the heavy lifting for detecting dependencies.

Code

public function getChildrenEntities() {
  $entities = array();
  $current = current($this->entities);
  if (!empty($this->dependencies)) {
    $entities = $this->dependencies;

    // In an iterator, having children means that the current key itself
    // isn't a part of the entities. However, we need that entity.. So we add
    // the parent as a part of the entities. And since children always should
    // go first, we add the parent last.
    $entities[] = $current;
  }
  return $entities;
}