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

getModelName should return array or string

Error message

getModelName should return array or string

What it means

Error "getModelName should return array or string" thrown in phalcon/cphalcon.

Source

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

                        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;
            }
        }

        if cache != null {
            cache->set(cacheKey, paramsCache);
        }

        let this->internalCache[cacheKey] = paramsCache;

View on GitHub (pinned to b7419de9cd)

When it happens

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