{"record":{"id":"a81a04c61cae90db","repo":"yiisoft/yii2","slug":"relation-names-are-case-sensitive-class-has-a-r-a81a04","errorCode":null,"errorMessage":"Relation names are case sensitive. {class} has a relation named \"{realName}\" instead of \"{name}\".","messagePattern":"Relation names are case sensitive\\. (.+?) has a relation named \"(.+?)\" instead of \"(.+?)\"\\.","errorType":"exception","errorClass":"yii\\base\\InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"framework/db/BaseActiveRecord.php","lineNumber":1281,"sourceCode":"            }\n\n            return null;\n        }\n        if (!$relation instanceof ActiveQueryInterface) {\n            if ($throwException) {\n                throw new InvalidArgumentException(get_class($this) . ' has no relation named \"' . $name . '\".');\n            }\n\n            return null;\n        }\n\n        if (method_exists($this, $getter)) {\n            // relation name is case sensitive, trying to validate it when the relation is defined within this class\n            $method = new \\ReflectionMethod($this, $getter);\n            $realName = lcfirst(substr($method->getName(), 3));\n            if ($realName !== $name) {\n                if ($throwException) {\n                    throw new InvalidArgumentException('Relation names are case sensitive. ' . get_class($this) . \" has a relation named \\\"$realName\\\" instead of \\\"$name\\\".\");\n                }\n\n                return null;\n            }\n        }\n\n        return $relation;\n    }\n\n    /**\n     * Establishes the relationship between two models.\n     *\n     * The relationship is established by setting the foreign key value(s) in one model\n     * to be the corresponding primary key value(s) in the other model.\n     * The model with the foreign key will be saved into database **without** performing validation\n     * and **without** events/behaviors.\n     *\n     * If the relationship involves a junction table, a new row will be inserted into the","sourceCodeStart":1263,"sourceCodeEnd":1299,"githubUrl":"https://github.com/yiisoft/yii2/blob/66f00d18a29b520f85e8e8f1e32d1e7e7b556cac/framework/db/BaseActiveRecord.php#L1263-L1299","documentation":"Error \"Relation names are case sensitive. {class} has a relation named \"{realName}\" instead of \"{name}\".\" thrown in yiisoft/yii2.","triggerScenarios":"Thrown at framework/db/BaseActiveRecord.php:1281 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"66f00d18a29b520f85e8e8f1e32d1e7e7b556cac","analyzedAt":"2026-08-17T05:17:23.470Z","schemaVersion":2},"datasetVersion":"2026-08-17T09:17:11.063Z"}