Add a value count aggregate.

@param $alias
@param string      $field
@param string|null $script
490233
public function valueCount($alias, $field = null, $script = null)
    {
        $aggregation = new ValueCountAggregation($alias, $field, $script);

        $this->append($aggregation);
    }
1346690
public void count(String propertyName, String alias) {
        final CountProjection proj = Projections.count(calculatePropertyName(propertyName));
        addProjectionToList(proj, alias);
    }
1053660
public function count($alias = null)
    {
        // prepare new query
        $q = $this->dsql()->del('fields')->del('order');

        // add expression field to query
        return $q->field($q->count(), $alias);
    }
954554
public function setConvertedValue($value, $alias = null)
    {
        if ($alias) {
            $this->convertedAliasValue[$alias] = $value;
        } else {
            $this->convertedValue = $value;
        }
    }
45713
public function addFieldSum($field, $alias = null)
    {
        $this->addField(new Func('sum', $field), $alias); return $this;
    }
236634
public function selectCount(string $column = '*', string $alias = null)
    {
        $instance = $this->selectQueryInstance();

        $instance->selectQuery()->count($column, $alias);

        return $instance;
    }
360000
public function justCount($countAttribute = 'u.id', $alias = 'totalcount')
    {
        $this->countQuery = true;
        $this->replaceSelect = 'COUNT(' . $countAttribute . ') as ' . $alias;
    }
896476
final public function countByColumn($column, $value, $field = null)
    {
        $this->validateShortcutData();
        $alias = 'count';

        if ($field === null) {
            $field = $this->getPk();
        }

        return (int) $this->db->select()
                            ->count($field, $alias)
                            ->from(static::getTableName())
                            ->whereEquals($column, $value)
                            ->query($alias);
    }
196446
public static function count(string $column, string $as = null, string $tableAlias = null): self
    {
        return new self(Aggregation\Type::COUNT, $column, $as, $tableAlias);
    }
498745
public function addSum($column, string $alias = null): self
    {
        return $this->addAggregate('SUM', $column, $alias);
    }
1239535
protected function addRefFKCount(&$script, ForeignKey $refFK)
    {
        $table = $this->getTable();
        $tblFK = $refFK->getTable();

        $peerClassname = $this->getStubPeerBuilder()->getClassname();
        $fkQueryClassname = $this->getNewStubQueryBuilder($refFK->getTable())->getClassname();
        $relCol = $this->getRefFKPhpNameAffix($refFK, $plural = true);

        $collName = $this->getRefFKCollVarName($refFK);

        $joinedTableObjectBuilder = $this->getNewObjectBuilder($refFK->getTable());
        $className = $joinedTableObjectBuilder->getObjectClassname();

        $script .= "
    /**
     * Returns the number of related $className objects.
     *
     * @param Criteria \$criteria
     * @param boolean \$distinct
     * @param PropelPDO \$con
     * @return int             Count of related $className objects.
     * @throws PropelException
     */
    public function count$relCol(Criteria \$criteria = null, \$distinct = false, PropelPDO \$con = null)
    {
        \$partial = \$this->{$collName}Partial && !\$this->isNew();
        if (null === \$this->$collName || null !== \$criteria || \$partial) {
            if (\$this->isNew() && null === \$this->$collName) {
                return 0;
            }

            if (\$partial && !\$criteria) {
                return count(\$this->get$relCol());
            }
            \$query = $fkQueryClassname::create(null, \$criteria);
            if (\$distinct) {
                \$query->distinct();
            }

            return \$query
                ->filterBy" . $this->getFKPhpNameAffix($refFK) . "(\$this)
                ->count(\$con);
        }

        return count(\$this->$collName);
    }
";
    }
845566
protected function addAddSelectColumns(&$script)
    {
        $script .= "
    /**
     * Add all the columns needed to create a new object.
     *
     * Note: any columns that were marked with lazyLoad=\"true\" in the
     * XML schema will not be added to the select list and only loaded
     * on demand.
     *
     * @param      Criteria \$criteria object containing the columns to add.
     * @param      string   \$alias    optional table alias
     * @throws PropelException Any exceptions caught during processing will be
     *		 rethrown wrapped into a PropelException.
     */
    public static function addSelectColumns(Criteria \$criteria, \$alias = null)
    {
        if (null === \$alias) {";
        foreach ($this->getTable()->getColumns() as $col) {
            if (!$col->isLazyLoad()) {
                $script .= "
            \$criteria->addSelectColumn(" . $this->getPeerClassname() . "::" . $this->getColumnName($col) . ");";
            } // if !col->isLazyLoad
        } // foreach
        $script .= "
        } else {";
        foreach ($this->getTable()->getColumns() as $col) {
            if (!$col->isLazyLoad()) {
                $script .= "
            \$criteria->addSelectColumn(\$alias . '." . $col->getName() . "');";
            } // if !col->isLazyLoad
        } // foreach
        $script .= "
        }";
        $script .= "
    }
";
    }
357808
public function from(string $table, string $alias = null, $field = null): Select
    {
        $this->from[] = [
          'table' => $table,
          'alias' => $alias
        ];

        if ($field !== null) {
            if (is_array($field)) {
                foreach ($field as $fld) {
                    $this->field(($alias ?? $table) . '.' . $fld);
                }
            } else {
                $this->field(($alias ?? $table) . '.' . $field);
            }
        }

        return $this;
    }
506990
public function track($alias, $field, Closure $scope = null) {
        $this->_counters[$alias] = [
            'field' => $field,
            'scope' => $scope
        ];

        return $this;
    }
838874
public function count($column = '*', string $alias = null, bool $distinct = false): self
    {
        return $this->column((new Expression())->count($column, $distinct), $alias);
    }
206860
private function setManyToManyValuedCondition($association, $alias, $arr)
    {
        if (empty($this->fieldValue['value']) || $this->position < count($arr) - 2) {
            return null;
        }
        $targetField = $this->position == count($arr) - 1 ? $association['joinTable']['joinColumns'][0]['referencedColumnName'] : end($arr);

        return $this->makeExpression($targetField, $this->fieldValue['operation'], $this->fieldValue['value'], $alias);
    }
993761
protected function addColumnAttributeComment(&$script, Column $col)
    {
        $cptype = $col->getPhpType();
        $clo = strtolower($col->getName());

        $script .= "
    /**
     * The value for the $clo field.";
        if ($col->getDefaultValue()) {
            if ($col->getDefaultValue()->isExpression()) {
                $script .= "
     * Note: this column has a database default value of: (expression) " . $col->getDefaultValue()->getValue();
            } else {
                $script .= "
     * Note: this column has a database default value of: " . $this->getDefaultValueString($col);
            }
        }
        $script .= "
     * @var        $cptype
     */";
    }