phalcon/cphalcon · error · Phalcon\Mvc\Model\Query\Exceptions\ResultsetClassNotFound

Resultset class ' ' not found

Error message

Resultset class '{className}' not found

What it means

When a model's getResultsetClass() names a custom resultset class, executeSelect() first checks class_exists(); an unknown class raises this ResultsetClassNotFound-style error. The faulty input is the class name string returned by getModelName()::getResultsetClass() — typo or non-autoloaded class.

Solutions

  1. Return an existing, fully-qualified resultset class from getResultsetClass()
  2. Register the class's namespace with the autoloader
  3. Remove getResultsetClass() if the default resultset suffices

Example fix

public function getResultsetClass() { return MyResultset::class; } // must exist and be autoloadable
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: Thrown at phalcon/Mvc/Model/Query.zep:1440 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/28331ea37106b8fa. Report an issue: GitHub.

Appendix: source

Thrown at phalcon/Mvc/Model/Query.zep:1440

                                attribute,
                                typesColumnMap[column]
                            ];
                        }
                    }
                }

                /**
                 * Check if the model keeps snapshots
                 */
                let isKeepingSnapshots = (bool) manager->isKeepingSnapshots(resultObject);
            }

            if resultObject instanceof ModelInterface && method_exists(resultObject, "getResultsetClass") {
                let resultsetClassName = (<ModelInterface> resultObject)->getResultsetClass();

                if resultsetClassName {
                    if unlikely !class_exists(resultsetClassName) {
                        throw new ResultsetClassNotFound(resultsetClassName);
                    }

                    if unlikely !is_subclass_of(resultsetClassName, ResultsetInterface::class) {
                        throw new InvalidResultsetClass(resultsetClassName);
                    }

                    return create_instance_params(
                        resultsetClassName,
                        [
                            simpleColumnMap,
                            resultObject,
                            resultData,
                            cache,
                            isKeepingSnapshots
                        ]
                    );
                }
            }

View on GitHub (pinned to b7419de9cd)