phalcon/cphalcon · error · Phalcon\Mvc\Model\Query\Exceptions\MultipleSqlStatementsNotSupported
This type of statement generates multiple SQL statements
Error message
This type of statement generates multiple SQL statements
What it means
Query::executeGetRelatedMethods (multi-execution path) supports only PHQL_T_SELECT; any other statement type would run multiple times and produce multiple SQL statements, so MultipleSqlStatementsNotSupported is thrown. The faulty input is a non-SELECT query passed to an API meant for repeated SELECT execution.
Solutions
- Use execute() instead of the getRelated* / multi-execution path for INSERT/UPDATE/DELETE
- Restrict iteration helpers to SELECT queries
- Split compound statements into separate queries
Example fix
if ($query->getType() === PHQL_T_SELECT) { $rows = $query->execute(); } Defensive patterns
Strategy: type-guard
Prevention
- Check $query->getType() before invoking multi-execution APIs
- Keep write operations on explicit execute() calls
When it happens
Trigger: Thrown at phalcon/Mvc/Model/Query.zep:587 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/a1577508df7c9607.
Report an issue: GitHub.
Appendix: source
Thrown at phalcon/Mvc/Model/Query.zep:587
{
var intermediate;
/**
* The statement is parsed from its PHQL string or a previously
* processed IR
*/
let intermediate = this->parse();
if this->type == PHQL_T_SELECT {
return this->executeSelect(
intermediate,
this->bindParams,
this->bindTypes,
true
);
}
throw new MultipleSqlStatementsNotSupported();
}
/**
* @return TransactionInterface|null
*/
public function getTransaction() -> <TransactionInterface> | null
{
return this->transaction;
}
/**
* Gets the type of PHQL statement executed
*
* @return int
*/
public function getType() -> int
{
return this->type;View on GitHub (pinned to b7419de9cd)