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

A dependency injection container is required to access the s

Error message

A dependency injection container is required to access the services related to the ODM in '{className}'

What it means

Error "A dependency injection container is required to access the services related to the ODM in '{className}'" thrown in phalcon/cphalcon.

Source

Thrown at phalcon/Mvc/Model.zep:279

    private static privatePropertiesCache = [];

    /**
     * Phalcon\Mvc\Model constructor
     */
    final public function __construct(
        var data = null,
        <DiInterface> container = null,
        <ManagerInterface> modelsManager = null
    ) {
        /**
         * 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;

View on GitHub (pinned to b7419de9cd)

When it happens

Trigger: Thrown at phalcon/Mvc/Model.zep:279 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/1a1a44835d4d5cf2. Report an issue: GitHub.