phalcon/cphalcon · error · Phalcon\Mvc\Model\Query\Exceptions\UnknownJoinType
Unknown join type , when preparing
Error message
Unknown join type {type}, when preparing: {phql} What it means
Thrown by Query::getJoinType when the join item's type token does not match any known join constant (INNER, LEFT, RIGHT, CROSS, FULL), meaning the PHQL parser emitted an unrecognized join type for this statement.
Solutions
- Verify the join keyword in the PHQL is one of INNER/LEFT/RIGHT/CROSS/FULL JOIN.
- Rewrite unsupported join syntax (e.g. NATURAL JOIN) using standard joins.
- Catch and log the PHQL plus join type; check for framework version mismatches.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at phalcon/Mvc/Model/Query.zep:2562 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/5345e6dc5068dbae.
Report an issue: GitHub.
Appendix: source
Thrown at phalcon/Mvc/Model/Query.zep:2562
switch type {
case PHQL_T_INNERJOIN:
return "INNER";
case PHQL_T_LEFTJOIN:
return "LEFT";
case PHQL_T_RIGHTJOIN:
return "RIGHT";
case PHQL_T_CROSSJOIN:
return "CROSS";
case PHQL_T_FULLJOIN:
return "FULL OUTER";
}
throw new UnknownJoinType(type, this->phql);
}
/**
* Processes the JOINs in the query returning an internal representation for
* the database dialect
*/
final protected function getJoins(array select) -> array
{
var models, sqlAliases, sqlAliasesModels, sqlModelsAliases,
sqlAliasesModelsInstances, modelsInstances, fromModels,
manager, selectJoins, joinItem, joins, joinData, schema, source,
model, realModelName, completeSource, joinType, aliasExpr, alias,
joinAliasName, joinExpr, fromModelName, joinAlias, joinModel,
joinSource, preCondition, modelNameAlias, relation, relations,
modelAlias, sqlJoin, sqlJoinItem, selectTables, tables, tableItem;
array sqlJoins, joinModels, joinSources, joinTypes, joinPreCondition,
joinPrepared;
View on GitHub (pinned to b7419de9cd)