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

The injected service 'modelsManager' is not valid in '{class

Error message

The injected service 'modelsManager' is not valid in '{className}'

What it means

Error "The injected service 'modelsManager' is not valid in '{className}'" thrown in phalcon/cphalcon.

Source

Thrown at phalcon/Mvc/Model.zep:290

         * We use a default DI if the user does not define one
         */
        if container === null {
            let container = Di::getDefault();
        }

        if container === null {
            throw new ModelOrmServicesUnavailable(get_class(this));
        }

        let this->container = container;

        /**
         * Inject the manager service from the DI
         */
        if modelsManager === null {
            let modelsManager = <ManagerInterface> container->getShared("modelsManager");
            if modelsManager === null {
                throw new InvalidModelsManagerService(get_class(this));
            }
        }

        /**
         * Update the models-manager
         */
        let this->modelsManager = modelsManager;

        /**
         * The manager always initializes the object
         */
        modelsManager->initialize(this);

        /**
         * This allows the developer to execute initialization stuff every time
         * an instance is created
         */
        if method_exists(this, "onConstruct") {

View on GitHub (pinned to b7419de9cd)

When it happens

Trigger: Thrown at phalcon/Mvc/Model.zep:290 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/29f55d84001fd8d0. Report an issue: GitHub.