создание мапы array('parent_id'=>'id')
@return type
514560
static public function getMapParentId()
    {
        if (self::$_mapPrentId)
        {
            return self::$_mapPrentId;
        }
        
        $model = Cache::remember('map_tree', self::$lifeCache, function()
        {
            return DB::table('menus')->get();
        });
        
        $map = array();
        foreach ($model as $val)
        {
            $map[$val->parent_id][] = $val->id;
        }
        unset($val);
        
        self::$_mapPrentId = $map;
        return $map;
    }
676884
public function getByType( $parentId, $parentType, $type ) {

		$modelClass = static::$modelClass;

		return $modelClass::findByType( $parentId, $parentType, $type );
	}
925634
public function getParentAssociationMapping()
    {
        // NEXT_MAJOR: remove array check
        if (\is_array($this->parentAssociationMapping) && $this->getParent()) {
            $parent = $this->getParent()->getCode();

            if (\array_key_exists($parent, $this->parentAssociationMapping)) {
                return $this->parentAssociationMapping[$parent];
            }

            throw new \InvalidArgumentException(sprintf(
                "There's no association between %s and %s.",
                $this->getCode(),
                $this->getParent()->getCode()
            ));
        }

        // NEXT_MAJOR: remove this line
        return $this->parentAssociationMapping;
    }
839473
public function getParentCategory()
    {
        $oCat = null;

        // loading only if parent id is not rootid
        if ($this->oxcategories__oxparentid->value && $this->oxcategories__oxparentid->value != 'oxrootid') {
            // checking if object itself has ref to parent
            if ($this->_oParent) {
                $oCat = $this->_oParent;
            } else {
                $oCat = oxNew(\OxidEsales\Eshop\Application\Model\Category::class);
                if (!$oCat->load($this->oxcategories__oxparentid->value)) {
                    $oCat = null;
                } else {
                    $this->_oParent = $oCat;
                }
            }
        }

        return $oCat;
    }
795747
public function getParentsAction()
    {
        $id = $this
            ->request
            ->query
            ->get('id');

        return $this->createResponseObject(function () use ($id) {
            return $this->normalizeLocationDataArray(
                $this
                    ->locationProvider
                    ->getParents($id)
            );
        });
    }
1362717
protected function get_parent_record() {
        global $DB;

        if (!isset($this->parentrecord)) {
            $this->parentrecord = $DB->get_record('event', ['id' => $this->parentid]);
        }

        return $this->parentrecord;
    }
754553
public function getParent()
    {
        $parentID = $this->getField("ParentID");
        if ($parentID) {
            return SiteTree::get_by_id(self::class, $parentID);
        }
        return null;
    }
1049393
public function nest()
    {
        $parentColumn = $this->parentColumn;
        if (!$parentColumn) {
            return $this;
        }

        // Set id as keys.
        $this->items = $this->getDictionary();

        $keysToDelete = [];

        // Add empty collection to each items.
        $collection = $this->each(function ($item) {
            if (!$item->{$this->childrenName}) {
                $item->{$this->childrenName} = app()->make('Illuminate\Support\Collection');
            }
        });

        // Remove items with missing ancestor.
        if ($this->removeItemsWithMissingAncestor) {
            $collection = $this->reject(function ($item) use ($parentColumn) {
                if ($item->$parentColumn) {
                    $missingAncestor = $this->anAncestorIsMissing($item);

                    return $missingAncestor;
                }
            });
        }

        // Add items to children collection.
        foreach ($collection->items as $key => $item) {
            if ($item->$parentColumn && isset($collection[$item->$parentColumn])) {
                $collection[$item->$parentColumn]->{$this->childrenName}->push($item);
                $keysToDelete[] = $item->id;
            }
        }

        // Delete moved items.
        $this->items = array_values(Arr::except($collection->items, $keysToDelete));

        return $this;
    }
405966
public function getParent() {
		$parentid = $this->{$this->parentKeyName};
		if (empty($parentid)) {
			return NULL;
		}
		$collname = $this->collectionName;
		$bitems = $collname::getInstance();
		$fparent = $bitems->itemGet($parentid);
		return $fparent;
	}
258251
public function getParentList(){
        if(!$this->isPropertyAvailable('ParentList')){
            $this->setProperty("ParentList", new SPList($this->getContext(),new ResourcePathEntity($this->getContext(),$this->getResourcePath(), "parentlist")),false);
        }
        return $this->getProperty("ParentList");
    }
895091
public function tree()
    {
        $items = $this->model
            ->orderBy('id')
            ->orderBy('parent_id')
            ->with($this->with)
            ->get(['id', 'title', 'parent_id'])
            ->toArray();

        return $this->toTree($items);
    }
1071189
public function getParentIds($rootId = 0)
    {
        if ($this->_parentIds === null) {
            // 增加对模型内置[[getAll()]]方法的支持，可避免多次查询数据库，优化性能
            if ($this->owner->hasMethod('getAll')) {
                $this->_parentIds = $this->getParentIdsInternal($rootId);
            } else {
                $this->_parentIds = Tree::getParentIds($this->owner, 0, $this->pkField, $this->parentField, $rootId);
            }
        }
        
        return $this->_parentIds;
    }
426112
public function get_child($myid) {
        $a = $newarr = array();
        if (is_array($this->arr)) {
            foreach ($this->arr as $id => $a) {
                if ($a['parent_id'] == $myid)
                    $newarr[$id] = $a;
            }
        }
        return $newarr ? $newarr : false;
    }
612680
public function getParentList()
    {
        if (null === $this->parentList) {
            $this->parentList = [];

            $parent = $this->getDescriptor()->getParent();

            for ($index = 1; null !== $parent; $index++) {
                $this->parentList[$parent->getName() . '-'] = $parent;

                $parent = $parent->getDescriptor()->getParent();
            }
        }

        return $this->parentList;
    }
1336491
public function getChildren($parent_id = null)
    {
        $parent_id = $parent_id ?? $this->id;
        $children = $this::find()
            ->where(['parent_id' => $parent_id, 'show' => true])
            ->orderBy(['position' => SORT_ASC])
            ->all();
        return $children;
    }
1121581
public function getOldChildren()
    {
        return static::find()->where([$this->parentAttribute => $this->getOldAttribute($this->refIdAttribute)])->all();
    }
1267114
protected final function getParent()
	{
		if($this->parent === false)
		{
			if(NULL === ($file = $this->getExtended()))
			{
				$this->parent = NULL;
			}
			else
			{
				$typeName = $this->factory->createView($this->renderer, $this->resolveResource($file));
				
				$this->parent = new $typeName($this->factory, $this->renderer);
				$this->parent->inherit($this->context, $this->exp);
			}
		}
		
		return $this->parent;
	}