Ejemplo n.º 1
0
 /**
  * Gets the Block nodes siblings at a version.
  *
  * Retrieving siblings from the database could be simple if we did not need to take
  * the changesets into account, because then we would just get all blocks with the same
  * parent. However the changesets in BlockLogEntry probably store changed parents and
  * so they must be applied on the entire tree first before we can tell.
  *
  * @param BlockInterface $block
  * @param integer        $rootVersion
  *
  * @return false|ArrayCollection
  */
 public function getSiblings(BlockInterface $block, $version = false)
 {
     $owner = $block->getOwner();
     $family = $this->findByOwner($owner, $version);
     $siblings = array();
     foreach ($family as $member) {
         if ($member->getParent() && $member->getParent()->getId() == $block->getParent()->getId()) {
             array_push($siblings, $member);
         }
     }
     return $siblings;
 }