phalcon/cphalcon · error · Phalcon\Paginator\Exceptions\MissingColumnsForHaving
When having is set there should be columns option provided f
Error message
When having is set there should be columns option provided for which calculate row count
What it means
Error "When having is set there should be columns option provided for which calculate row count" thrown in phalcon/cphalcon.
Source
Thrown at phalcon/Paginator/Adapter/QueryBuilder.zep:189
/**
* Execute the query an return the requested slice of data
*/
let items = query->execute();
let hasHaving = !empty totalBuilder->getHaving();
let groups = totalBuilder->getGroupBy();
let hasGroup = !empty groups;
/**
* Change the queried columns by a COUNT(*)
*/
if hasHaving && !hasGroup {
if unlikely empty columns {
throw new MissingColumnsForHaving();
}
totalBuilder->columns(columns);
} else {
let hasDistinct = false,
builderColumns = builder->getColumns();
if typeof builderColumns == "string" && stripos(trim(builderColumns), "DISTINCT ") === 0 {
let distinctColumn = trim(substr(trim(builderColumns), 9));
let hasDistinct = true;
if strpos(distinctColumn, ",") !== false {
totalBuilder->columns(["DISTINCT " . distinctColumn]);
let hasMultipleGroups = true;
} else {
totalBuilder->columns(
["COUNT(DISTINCT " . distinctColumn . ") AS [rowcount]"]
);View on GitHub (pinned to b7419de9cd)
When it happens
Trigger: Thrown at phalcon/Paginator/Adapter/QueryBuilder.zep:189 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of phalcon/cphalcon@b7419de9cd (2026-08-21).
Data as JSON: /api/errors/769dd83711da891d.
Report an issue: GitHub.