Jarves\Storage\Propel::getBranchChildrenCount PHP Method

getBranchChildrenCount() public method

public getBranchChildrenCount ( $pk = null, Condition $condition = null, $scope = null )
$condition Jarves\Configuration\Condition
    public function getBranchChildrenCount($pk = null, Condition $condition = null, $scope = null)
    {
        $query = $this->getQueryClass();
        $query->clearSelectColumns()->addSelectColumn('COUNT(*)');
        if ($pk) {
            $pk2Query = $this->getQueryClass();
            $this->mapPk($pk2Query, $pk);
            $pk2Item = $pk2Query->findOne();
            if (!$pk2Item) {
                return null;
            }
            $query->childrenOf($pk2Item);
        } elseif ($scope) {
            $pk2Query = $this->getQueryClass();
            $root = $pk2Query->findRoot($scope);
            if (!$root) {
                return null;
            }
            $query->childrenOf($root);
        }
        $stmt = $this->getStm($query, $condition);
        $row = $stmt->fetch(\PDO::FETCH_ASSOC);
        return current($row) + 0;
    }