Home  Support  API

RowCountProjection Class Reference
[Projections]


Projection for counting the raw number of resulting rows (using the primary key).

Example:

 // SELECT COUNT(entity_id) FROM ...
 $query = new EntityQuery(Entity::orm());
 $query->get(new RowCountProjection());
 echo $query->getCell();

Hint: there is a shorthand for counting rows: EntityQuery::getCount()

Definition at line 34 of file RowCountProjection.class.php.

Inheritance diagram for RowCountProjection:
Inheritance graph

List of all members.

Public Member Functions

 __construct ($alias=null)
 fill (SelectQuery $selectQuery, EntityQueryBuilder $entityQueryBuilder)
 Fills the SelectQuery in context of the specified ORM-related entity.
 getFunc ()
 Gets the name of the aggregates.

Protected Member Functions

 getSqlFunction (EntityQueryBuilder $entityQueryBuilder)
 Create a SQLFunction with the expression as the argument.

Protected Attributes

 $alias
 $expression

Constructor & Destructor Documentation

RowCountProjection::__construct ( alias = null  ) 
Parameters:
string $alias optional label for the result of the aggregator

Definition at line 39 of file RowCountProjection.class.php.

References AggrProjection::$alias.


Member Function Documentation

CountProjection::fill ( SelectQuery selectQuery,
EntityQueryBuilder entityQueryBuilder 
) [inherited]

Fills the SelectQuery in context of the specified ORM-related entity.

Returns:
void

Reimplemented from AggrProjection.

Definition at line 45 of file CountProjection.class.php.

References EntityQueryBuilder::getEntity().

AggrProjection::getFunc (  )  [inherited]

Gets the name of the aggregates.

Returns:
string

Definition at line 50 of file AggrProjection.class.php.

Referenced by DistinctCountProjection::getSqlFunction(), and AggrProjection::getSqlFunction().

AggrProjection::getSqlFunction ( EntityQueryBuilder entityQueryBuilder  )  [protected, inherited]

Create a SQLFunction with the expression as the argument.

Parameters:
EntityQuery $entityQuery
Returns:
SqlFunction

Reimplemented in DistinctCountProjection.

Definition at line 66 of file AggrProjection.class.php.

References AggrProjection::getFunc(), and EntityQueryBuilder::subject().

Referenced by AggrProjection::fill().


Member Data Documentation

AggrProjection::$alias [protected, inherited]
AggrProjection::$expression [protected, inherited]

Definition at line 28 of file AggrProjection.class.php.

Referenced by AggrProjection::__construct().


The documentation for this class was generated from the following file: