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

There is no defined relations for the model '{className}' us

Error message

There is no defined relations for the model '{className}' using alias '{alias}'

What it means

Error "There is no defined relations for the model '{className}' using alias '{alias}'" thrown in phalcon/cphalcon.

Source

Thrown at phalcon/Mvc/Model.zep:2311

     */
    public function getRelated(string alias, arguments = null)
    {
        var relation, className, manager, result, lowerAlias;

        /**
         * Query the relation by alias
         */
        let className = get_class(this),
            manager = <ManagerInterface> this->modelsManager,
            lowerAlias = strtolower(alias);

        let relation = <RelationInterface> manager->getRelationByAlias(
            className,
            lowerAlias
        );

        if unlikely typeof relation !== "object" {
            throw new RelationNotDefined(className, alias);
        }

        /**
         * If there are any arguments, Manager with handle the caching of the records
         */
        if arguments === null {
//            /**
//             * If the related records are already in cache and the relation is reusable,
//             * we return the cached records.
//             */
//            if relation->isReusable() && this->isRelationshipLoaded(lowerAlias) {
//                let result = this->related[lowerAlias];
//            } else {
//                /**
//                 * Call the 'getRelationRecords' in the models manager.
//                 */
//                let result = manager->getRelationRecords(relation, this, arguments);
//

View on GitHub (pinned to b7419de9cd)

When it happens

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