Get the parent cID of a page given its cID.

@param int $cID

@return int|null
7698
public static function getCollectionParentIDFromChildID($cID)
    {
        $db = Database::connection();
        $q = 'select cParentID from Pages where cID = ?';
        $cParentID = $db->fetchColumn($q, [$cID]);

        return $cParentID;
    }
335465
public static function get_subtype_parent($type) {
        self::init();

        if (isset(self::$parents[$type])) {
            return self::$parents[$type];
        }

        return null;
    }
970153
function get_parent(){
		if( !is_null($this->pidx) && isset(self::$reg[$this->pidx]) ){
			return self::$reg[$this->pidx];
		}
		else {
			return null;
		}
	}
128680
public static function incrementParents($cID)
    {
        $db = Loader::db();
        $cParentID = $db->GetOne("select cParentID from Pages where cID = ?", array($cID));

        $q = "update Pages set cChildren = cChildren+1 where cID = ?";

        $cpc = Page::getByID($cParentID);
        $cpc->refreshCache();

        $r = $db->query($q, array($cParentID));
    }
122093
public function actionEditForum($cid = null, $id = null)
    {
        $model = Forum::find()->where(['id' => $id, 'category_id' => $cid])->limit(1)->one();
        if (empty($model)) {
            $this->error(Yii::t('podium/flash', 'Sorry! We can not find Forum with this ID.'));
            return $this->redirect(['admin/forums', 'cid' => $cid]);
        }
        if ($model->load(Yii::$app->request->post())) {
            if ($model->save()) {
                Log::info('Forum updated', $model->id, __METHOD__);
                $this->success(Yii::t('podium/flash', 'Forum has been updated.'));
                return $this->refresh();
            }
            $this->error(Yii::t('podium/flash', 'Sorry! There was an error while updating the forum.'));
        }
        return $this->render('forum', [
            'model' => $model,
            'forums' => Forum::find()->where(['category_id' => $cid])->orderBy(['sort' => SORT_ASC, 'id' => SORT_ASC])->all(),
            'categories' => Category::find()->orderBy(['sort' => SORT_ASC, 'id' => SORT_ASC])->all()
        ]);
    }
1337960
public function findChildrenByParentId($parent_id)
    {
        $qb = $this->createQueryBuilder();
        $qb->andWhere($qb->getRootAliases()[0] . '.parent = ' . $this->addNamedParameter('parent', $parent_id, $qb))
            ->orderBy($qb->getRootAliases()[0] . '.position', 'ASC');
        return $qb->getQuery()->getResult();
    }
896302
public static function delFdByCoId(int $cid = null): bool
    {
        $cid = $cid > -1 ? $cid : self::getCoroutineId();

        if (isset(self::$map[$cid])) {
            unset(self::$map[$cid]);

            return true;
        }

        return false;
    }
937045
public function getChildren($parentId)
    {
        return $this->channelList->filter(function (Channel $channel) use ($parentId) {
            return $channel->getParentId() == $parentId;
        });
    }
330297
public function get($cid, $options = array())
    {
        $options += array(
            'lifespan' => 0,
            'default' => null
        );

        $result = null;
        $this->hook->attach('cache.get.before', $cid, $options, $result, $this);

        if (isset($result)) {
            return $result;
        }

        if (is_array($cid)) {
            $cid = gplcart_array_hash($cid);
        }

        $this->file = GC_DIR_CACHE . "/$cid.cache";

        $result = $options['default'];

        if (is_file($this->file)) {

            $this->filemtime = filemtime($this->file);

            if (empty($options['lifespan']) || ((GC_TIME - $this->filemtime) < $options['lifespan'])) {
                $result = unserialize(file_get_contents($this->file));
            }
        }

        $this->hook->attach('cache.get.after', $cid, $options, $result, $this);
        return $result;
    }
612665
protected function getPageId($pid)
    {
        $pid = (int)$pid;
        if ($pid > 0) {
            return $pid;
        }
        $row = BackendUtilityCore::getRecord('tt_content', abs($pid), 'uid,pid');
        return $row['pid'];
    }
473792
public function getNextPosition($parentId)
    {
        $query = $this->getEntityManager()->createQuery('SELECT MAX(p.position) FROM FulgurioLightCMSBundle:Page p WHERE p.parent=:parentId AND p.page_type=:pageType');
        $query->setParameter('pageType', 'page');
        $query->setParameter('parentId', $parentId);
        return $query->getSingleScalarResult() + 1;
    }
800792
public function run( $cid ) {

		if( isset( $this->model ) && isset( $cid ) ) {

			$modelTagService = Yii::$app->factory->get( 'modelTagService' );

			$modelTag = $modelTagService->getById( $cid );

			if( isset( $modelTag ) && $modelTag->isParentValid( $this->model->id, $this->parentType ) ) {

				$modelTagService->delete( $modelTag );

				// Trigger Ajax Success
				return AjaxUtil::generateSuccess( Yii::$app->coreMessage->getMessage( CoreGlobal::MESSAGE_REQUEST ) );
			}
		}

		// Trigger Ajax Failure
		return AjaxUtil::generateFailure( Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_NOT_FOUND ) );
	}
80499
public function characteristicsReadItemIndex($cid) {
    $query = $this->connection->select('site_commerce_characteristics_item_index', 'n');
    $query->fields('n');
    $query->condition('cid', $cid);

    return $query->execute()->fetchObject();
  }
24899
public function get_cidr($ip) {
    // extract IP version and number
    list($ipVersion, $ipNumber) = self::ipVersionAndNumber($ip);
    // perform the binary search proper (if the IP address was invalid, binSearch will return false)
    $resp = $this->binSearch($ipVersion, $ipNumber, true);
    if(!empty($resp)) {
      list($ip_from, $ip_to) = $resp;
      $i=32; $mask=1;
      while(($ip_to & $mask) == 0) {
        $mask *= 2; $i--;
      }
      $ip = long2ip($ip_from);
      return "$ip/$i";
    }
    return false;
  }
248160
public function getParent(string $id = null)
    {
        if (!$this->_parents || ($id !== null && !isset($this->_parents[$id]))) {
            return null;
        }

        return $id !== null ?
            $this->_parents[$id] :
            $this->_parents[array_rand($this->_parents)];
    }
870211
public function getCollectionParentIDs()
    {
        $cIDs = array($this->cParentID);
        $db = Database::connection();
        $aliasedParents = $db->fetchAll('SELECT cParentID FROM Pages WHERE cPointerID = ?', array($this->cID));
        foreach ($aliasedParents as $aliasedParent) {
            $cIDs[] = $aliasedParent['cParentID'];
        }

        return $cIDs;
    }
0
protected function parentId()
	{
		switch ( $this->position )
		{
			case 'root':
				return null;

			case 'child':
				return $this->target->getKey();

			default:
				return $this->target->getParentId();
		}
	}