{"record":{"id":"f16a523d8e6e58f4","repo":"doctrine/orm","slug":"cannot-use-simpleobjecthydrator-with-a-resultsetma","errorCode":null,"errorMessage":"Cannot use SimpleObjectHydrator with a ResultSetMapping that contains more than one object result.","messagePattern":"Cannot use SimpleObjectHydrator with a ResultSetMapping that contains more than one object result\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/Internal/Hydration/SimpleObjectHydrator.php","lineNumber":34,"sourceCode":"use function array_search;\nuse function assert;\nuse function count;\nuse function in_array;\nuse function is_array;\nuse function key;\nuse function reset;\nuse function sprintf;\n\nclass SimpleObjectHydrator extends AbstractHydrator\n{\n    use SQLResultCasing;\n\n    private ClassMetadata|null $class = null;\n\n    protected function prepare(): void\n    {\n        if (count($this->resultSetMapping()->aliasMap) !== 1) {\n            throw new RuntimeException('Cannot use SimpleObjectHydrator with a ResultSetMapping that contains more than one object result.');\n        }\n\n        if ($this->resultSetMapping()->scalarMappings) {\n            throw new RuntimeException('Cannot use SimpleObjectHydrator with a ResultSetMapping that contains scalar mappings.');\n        }\n\n        $this->class = $this->getClassMetadata(reset($this->resultSetMapping()->aliasMap));\n    }\n\n    protected function cleanup(): void\n    {\n        parent::cleanup();\n\n        $this->uow->triggerEagerLoads();\n        $this->uow->hydrationComplete();\n    }\n\n    /**","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/doctrine/orm/blob/d9b9ff73016bf598ae07515f97289ce8074e97a5/src/Internal/Hydration/SimpleObjectHydrator.php#L16-L52","documentation":"Error \"Cannot use SimpleObjectHydrator with a ResultSetMapping that contains more than one object result.\" thrown in doctrine/orm.","triggerScenarios":"Thrown at src/Internal/Hydration/SimpleObjectHydrator.php:34 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":"d9b9ff73016bf598ae07515f97289ce8074e97a5","analyzedAt":"2026-08-21T06:13:15.863Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}