phalcon/cphalcon · error · Phalcon\Mvc\Model\Exceptions\MissingModelClassName

You should provide model class name for

Error message

You should provide model class name for {paramKey} parameter

What it means

Thrown by Binder when the handler's getModelName() returned an array of parameter-name => model-class mappings but the array has no entry for the given paramKey, so the model class for that route parameter cannot be determined.

Solutions

  1. Add the missing parameter key to the array returned by getModelName(), matching the parameter name in the route/action signature
  2. Or return a single model class string from getModelName() if only one model parameter exists
  3. Verify the parameter name spelling in both the route definition and the action signature
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at phalcon/Mvc/Model/Binder.zep:229 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/ec63c9802a30c488. Report an issue: GitHub.

Appendix: source

Thrown at phalcon/Mvc/Model/Binder.zep:229

            let boundModel = null;
            let paramValue = params[paramKey];

            if className == Model::class {
                if realClasses == null {
                    if handler instanceof BindModelInterface {
                        let handlerClass = get_class(handler);
                        let realClasses = {handlerClass}::getModelName();
                    } elseif handler instanceof BindableInterface {
                        let realClasses = handler->getModelName();
                    } else {
                        throw new HandlerMustImplementBindable();
                    }
                }

                if typeof realClasses == "array" {
                    if unlikely !fetch className, realClasses[paramKey] {
                        throw new MissingModelClassName(paramKey);
                    }

                    let boundModel = this->findBoundModel(paramValue, className);
                } elseif typeof realClasses == "string" {
                    let className = realClasses;
                    let boundModel = this->findBoundModel(paramValue, className);
                } else {
                    throw new InvalidGetModelNameReturn();
                }
            } elseif is_subclass_of(className, Model::class) {
                let boundModel = this->findBoundModel(paramValue, className);
            }

            if boundModel != null {
                let this->originalValues[paramKey] = paramValue;
                let params[paramKey] = boundModel;
                let this->boundModels[paramKey] = boundModel;
                let paramsCache[paramKey] = className;

View on GitHub (pinned to b7419de9cd)