@param string $parentId
@param array  $list

@return bool
439352
protected function parentInList($parentId, $list)
    {
        foreach ($list as $node) {
            if ($parentId === $node->getNodeId()) {
                return true;
            }
        }

        return false;
    }
1217678
private function nestedNodeExists(&$array, $parent_id, $child) {
		foreach ($array as &$a) {
			if ($a->id == $parent_id) {
				$a->children[] = $child;
				return true;
			} elseif (count($a->children) && self::nestedNodeExists($a->children, $parent_id, $child)) {
				return true;
			}
		}
		return false;
	}
205893
public function count($parentId, array $query = [])
    {
        $resource = $this->createPartialResourceUrlForList($parentId).'/count';

        return $this->client->get($resource, $query)['count'];
    }
861649
public function getCountByParent( $parentId, $parentType ) {

		$modelClass	= static::$modelClass;

		return $modelClass::queryByParent( $parentId, $parentType )->count();
	}
927289
public function fromArray( array $list )
	{
		$unknown = array();
		$list = parent::fromArray( $list );

		foreach( $list as $key => $value )
		{
			switch( $key )
			{
				case 'order.base.address.baseid': $this->setBaseId( $value ); break;
				case 'order.base.address.addressid': $this->setAddressId( $value ); break;
				case 'order.base.address.type': $this->setType( $value ); break;
				default: $unknown[$key] = $value;
			}
		}

		return $unknown;
	}
1259568
public function has($id)
    {
        /** @var ContainerInterface $item */
        foreach ($this->list as $item) {
            if ($item->has($id)) {
                return true;
            }
        }

        return false;
    }
1319861
public function getFollowersIdList( $parentId, $parentType ) {

        return self::findList( [  'column' => 'modelId', 'conditions' => [ 'type' => IFollower::TYPE_FOLLOW, 'active' => true, 'parentId' => $parentId, 'parentType' => $parentType ] ] );
    }
200478
public function findAll($parentId, array $query = [])
    {
        $resource = $this->createPartialResourceUrlForList($parentId);
        $data = $this->client->get($resource, $query);

        return $this->createMany(reset($data));
    }
1233685
public function setParentId( $parentid )
	{
		if ( $parentid == $this->getParentId() ) { return; }

		$this->_values['parentid'] = (int) $parentid;
		$this->setModified();
	}
357725
public function addItem($parentId, $data)
    {
        if (empty($parentId)) {
            $this->items[0][] = $data;
        } else {
            $this->items[$parentId][] = $data;
        }
    }
928930
public function findByParentAndSite($parentId, $siteId)
    {
        $qb = $this->createQueryBuilder();
        if ($parentId) {
            $qb->field('parent.$id')->equals(new \MongoId($parentId));
        }
        $qb->field('siteId')->equals($siteId);

        return $qb->getQuery()->execute();
     }
314199
private function validateParentId($parentId) : array
    {
        if (!empty($parentId)) {
            if (is_array($parentId)) {
                if (count($parentId) != count($parentId, COUNT_RECURSIVE)) {
                    throw new JsonParserException(
                        'Error assigning parentId to a CSV file! $parentId array cannot be multidimensional.',
                        [
                            'parentId' => $parentId
                        ]
                    );
                }
            } else {
                $parentId = ['JSON_parentId' => $parentId];
            }
        } else {
            $parentId = [];
        }
        $result = [];
        foreach ($parentId as $key => $value) {
            $result[$this->structure->getParentTargetName($key)] = $value;
        }
        return $result;
    }
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 ] );
	}
1180789
public function setParentId($parentId)
    {
        return (is_string($this->parentAttribute) && !empty($this->parentAttribute)) ?
        $this->{$this->parentAttribute} = $parentId : null;
    }
1279992
public function in($id, array $ids)
    {
        $allParents = $this->getHierarchy($id);

        /**
         * To increase the efficiency, we can index the results of the parent.
         */
        $allParentsIndexed = [];
        foreach ($allParents as $parent) {
            $allParentsIndexed[$parent->getId()] = $parent;
        }

        foreach ($ids as $possibleParentId) {
            if (isset($allParentsIndexed[$possibleParentId])) {
                return true;
            }
        }

        return false;
    }
1014224
public function getChildren($parentID)
    {
        $tmp = [];
        foreach($this->categoryList as $key => $item){
            if($item->parentID == $parentID) {
                $tmp[] = $item;
            }
        }

        return $tmp;
    }
329769
private function hasChild($rows, $id)
    {
        foreach ($rows as $row) {
            if ($row['parent_id'] == $id) {
                return true;
            }
        }

        return false;
    }