Searches for, and returns by reference, the parent bundle line.

@param array $lines
The lines to search for the parent bundle line.
@param $parentId
The meta-bundle-id value to search for.

@return array|null
The parent bundle line or null if not found.
977651
protected function &getParentBundle(array &$lines, $parentId)
    {
        foreach ($lines as &$line) {
            if (!empty($line[Meta::BundleId]) && $line[Meta::BundleId] === $parentId) {
                return $line;
            } elseif (!empty($line[Meta::ChildrenLines])) {
                // Recursively search for the parent bundle.
                $parent = &$this->getParentBundle($line[Meta::ChildrenLines], $parentId);
                if ($parent !== null) {
                    return $parent;
                }
            }
        }
        // Not found.
        return null;
    }
943046
public static function queryByParent( $parentId, $parentType ) {

		$tableName = static::tableName();

		return self::queryWithModel()->where( "$tableName.parentId=:pid AND $tableName.parentType=:ptype", [ ':pid' => $parentId, ':ptype' => $parentType ] );
	}
1319861
public function getFollowersIdList( $parentId, $parentType ) {

        return self::findList( [  'column' => 'modelId', 'conditions' => [ 'type' => IFollower::TYPE_FOLLOW, 'active' => true, 'parentId' => $parentId, 'parentType' => $parentType ] ] );
    }
844203
public function findParentNodesByChildId($id)
	{
        // To be returned
        $result = array();

        $rl = $this->getRelations();
        $data = $rl[RelationBuilder::TREE_PARAM_ITEMS];

        // If can't find, then return empty array
        if (!isset($data[$id])) {
            return array();
        }

        $current = $data[$id];
        $parentId = $current[RelationBuilder::TREE_PARAM_PARENT_ID];

        while (isset($data[$parentId])) {
            $current = $data[$parentId];
            $parentId = $current[RelationBuilder::TREE_PARAM_PARENT_ID];

            array_push($result, $current);
        }

        return $result;
    }
1235594
public function getParent($parentId)
    {
        if ($parentId && isset($this->site->pages[$parentId])) {
            return $this->site->pages[$parentId];
        }

        return [];
    }
1255368
public static function queryByTypeParentTypeModelId( $type, $parentType, $modelId ) {

		return self::find()->where( 'type=:type AND parentType=:ptype AND modelId=:mid', [ ':type' => $type, ':parentType' => $parentType, ':mid' => $modelId ] );
	}
837405
public function getParentByPageId($pageId)
    {
        $data = array();
        $success = 0;

        $treeSite = $this->getServiceLocator()->get('MelisSiteTree');

        if($treeSite){
            $data  = $treeSite->getParentByPageId($pageId);
        }


        return $data;
    }
641820
public function getTermsTreeData($parentID = 0)
    {
        $tree = Hierarchy::getTree($this->id);

        $data = [];

        static::mapTreeDataRecursive($tree, $data, $parentID);

        return $data;
    }
870235
public function getAllChildren($parentID)
    {
        $children = $this->getChildren($parentID);
        foreach ($children as $key => $child){
            $this->categoriesToBeDeleted[$child->categoryID] = $child;
            $this->getAllChildren($child->categoryID);
        }
    }
980971
private function getChildsForLinkedLayer($layerId, $parentLayer)
    {
        $childLayers = C4gMapsModel::findPublishedByPid($layerId);
        $arrLayerData['childs'] = [];
        
        foreach ($childLayers as $childLayer) {
            if ($childLayer->location_type !== "none") {
                // we reached the "bottom" of the tree leaf
                $childData = $this->parseLayer($childLayer);
                $childData['pid'] = $parentLayer->id;
                $arrLayerData['childs'][] = $childData;
                $arrLayerData['hide'] = $parentLayer->data_hidelayer;
            } else {
                $currentChildLayer = $this->parseLayer($childLayer);
                // set correct pid for the contentless element
                $currentChildLayer['pid'] = $parentLayer->id;
                // $childLayer is the acutal existing layer.
                $arrChildData = $this->getChildsForLinkedLayer($childLayer->id, (object) $currentChildLayer);
                $currentChildLayer['childs'] = $arrChildData['childs'];
                $currentChildLayer['content'] = [];
                $currentChildLayer['hasChilds'] = count($currentChildLayer['childs']) > 0;
                $currentChildLayer['childsCount'] = count($currentChildLayer['childs']);
                $arrLayerData['childs'][] = $currentChildLayer;
            }
            
            $arrLayerData['content'] = [];
            $arrLayerData['hasChilds'] = count($arrLayerData['childs']) > 0;
            $arrLayerData['childsCount'] = count($arrLayerData['childs']);
        }
        
        return $arrLayerData;
    }
990168
public function getParent($id)
    {
        if ($parent = $this->qb
            ->from($this->table)
            ->where($this->parentKey, $id)
            ->get(1)) {
            if ($parent->count() == 1) {
                return $parent;
            }
        }

        return false;
    }
1006144
public function listParents($fileId, $optParams = array()) {
      $params = array('fileId' => $fileId);
      $params = array_merge($params, $optParams);
      $data = $this->__call('list', array($params));
      if ($this->useObjects()) {
        return new ParentList($data);
      } else {
        return $data;
      }
    }
208925
public static function findByParentCartId( $parentId, $parentType, $orderId ) {

		return self::find()->where( 'parentId=:pid AND parentType=:ptype AND orderId=:oid', [ ':pid' => $parentId, ':ptype' => $parentType, ':oid' => $orderId ] )->one();
	}
248496
public function getParent($id)
    {
        /** @var Statement $statement */
        $dataItem     = $this->get($id);
        $queryBuilder = $this->driver->getSelectQueryBuilder();
        $queryBuilder->andWhere($this->driver->getUniqueId() . " = " . $dataItem->getAttribute($this->getParentField()));
        $statement  = $queryBuilder->execute();
        $rows       = array($statement->fetch());
        $hasResults = count($rows) > 0;
        $parent     = null;

        if ($hasResults) {
            $this->driver->prepareResults($rows);
            $parent = $rows[0];
        }

        return $parent;
    }
515178
public function delete($line, $lines)
    {
        foreach (range(0, $lines-1) as $offset) {
            $this->lines[$line+$offset-1] = null;
        }
        return $this;
    }
1202551
public function getChildOrganizations($parentId = null)
    {
        static $children;

        if (is_null($parentId)) {
            return array();
        }

        if (! isset($children[$parentId])) {
            $organizations = $this->db->fetchPairs(
                    'SELECT gor_id_organization, gor_name
                        FROM gems__organizations
                        WHERE gor_active=1 AND gor_has_login=1 AND
                            (gor_accessible_by LIKE ' . $this->db->quote('%:' . $parentId . ':%') . ' OR
                                gor_id_organization = ' . $this->db->quote($parentId) .  ')
                            ORDER BY gor_name');

            natsort($organizations);

            $children[$parentId] = $organizations;
        }

        return $children[$parentId];
    }
1262277
public function getParentNodes($dsId)
    {
        $parents = [];

        $node = $this->getNode($dsId);
        while ($node) {
            // get parent
            $node = $this->getParentNode($node->getDsId());

            // add id
            if ($node) {
                $parents[] = $node;
            }
        }

        return $parents;
    }