{"record":{"id":"1001e1b2cce5a52d","repo":"doctrine/orm","slug":"the-query-returned-a-row-containing-multiple-colum","errorCode":null,"errorMessage":"The query returned a row containing multiple columns. Change the query or use a different result function like getScalarResult().","messagePattern":"The query returned a row containing multiple columns\\. Change the query or use a different result function like getScalarResult\\(\\)\\.","errorType":"exception","errorClass":"Doctrine\\ORM\\NonUniqueResultException","httpStatus":null,"severity":"error","filePath":"src/Internal/Hydration/SingleScalarHydrator.php","lineNumber":35,"sourceCode":"class SingleScalarHydrator extends AbstractHydrator\n{\n    protected function hydrateAllData(): mixed\n    {\n        $data    = $this->statement()->fetchAllAssociative();\n        $numRows = count($data);\n\n        if ($numRows === 0) {\n            throw new NoResultException();\n        }\n\n        if ($numRows > 1) {\n            throw new NonUniqueResultException('The query returned multiple rows. Change the query or use a different result function like getScalarResult().');\n        }\n\n        $result = $this->gatherScalarRowData($data[key($data)]);\n\n        if (count($result) > 1) {\n            throw new NonUniqueResultException('The query returned a row containing multiple columns. Change the query or use a different result function like getScalarResult().');\n        }\n\n        return array_shift($result);\n    }\n}\n","sourceCodeStart":17,"sourceCodeEnd":41,"githubUrl":"https://github.com/doctrine/orm/blob/d9b9ff73016bf598ae07515f97289ce8074e97a5/src/Internal/Hydration/SingleScalarHydrator.php#L17-L41","documentation":"Error \"The query returned a row containing multiple columns. Change the query or use a different result function like getScalarResult().\" thrown in doctrine/orm.","triggerScenarios":"Thrown at src/Internal/Hydration/SingleScalarHydrator.php:35 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"}