{"record":{"id":"b102476af9a27204","repo":"phalcon/cphalcon","slug":"unknown-method-method","errorCode":null,"errorMessage":"Unknown method: [{method}]","messagePattern":"Unknown method: \\[(.+?)\\]","errorType":"exception","errorClass":"Phalcon\\DataMapper\\Pdo\\Exception\\UnknownQueryMethod","httpStatus":null,"severity":"error","filePath":"phalcon/DataMapper/Query/Select.zep","lineNumber":94,"sourceCode":"        ];\n\n        if likely isset proxied[method] {\n            return call_user_func_array(\n                [\n                    this->connection,\n                    method\n                ],\n                array_merge(\n                    [\n                        this->getStatement(),\n                        this->getBindValues()\n                    ],\n                    params\n                )\n            );\n        }\n\n        throw new UnknownQueryMethod(method);\n    }\n\n    /**\n     * Sets a `AND` for a `HAVING` condition\n     *\n     * @param string     $condition\n     * @param mixed|null $value\n     * @param int        $type\n     *\n     * @return Select\n     */\n    public function andHaving(\n        string condition,\n        var value = null,\n        int type = -1\n    ) -> <Select> {\n        this->having(condition, value, type);\n","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/DataMapper/Query/Select.zep#L76-L112","documentation":"Thrown by the magic __call() of Phalcon\\DataMapper\\Query\\Select. Select proxies exactly ten connection methods to the underlying connection: fetchAffected, fetchAll, fetchAssoc, fetchCol, fetchGroup, fetchObject, fetchObjects, fetchOne, fetchPairs, fetchValue (hardcoded whitelist in Select.zep lines 65-76). Any other method name falls through to 'throw new UnknownQueryMethod(method)'. The exception extends PHP's BadMethodCallException, so it is a pure developer-error signal, not a runtime condition to recover from.","triggerScenarios":"Calling a fetch method outside the whitelist on a Select object: $select->fetchColumn() (the real name is fetchCol()), $select->fetchRow(), $select->fetchScalar() (real name fetchValue()), or a typo like fetchone(). Also calling a Connection-level method that was never proxied (e.g. $select->fetchAffected() is proxied but $select->query() is not), or a query-building method that does not exist on Select.","commonSituations":"Copy-pasting PDO/PDOStatement calls (fetchColumn, fetchAll with fetch mode args) onto a Select object; porting code between Atlas/Aura.Sql Query objects and Phalcon's DataMapper Select; IDE autocompletion suggesting a similarly named method; upgrading from an older Phalcon version where a fetch alias existed.","solutions":["Use one of the ten proxied names: fetchAffected, fetchAll, fetchAssoc, fetchCol, fetchGroup, fetchObject, fetchObjects, fetchOne, fetchPairs, fetchValue","For a single scalar use fetchValue(); for one column across rows use fetchCol(); for key-value pairs use fetchPairs()","If you need a non-proxied connection method, run the statement yourself: $connection->fetchAll($select->getStatement(), $select->getBindValues())","Fix typos: fetchcolumn -> fetchCol, fetchone -> fetchOne, fetchPair -> fetchPairs"],"exampleFix":"// before\n$id = $select->fetchColumn();\n\n// after\n$id = $select->fetchCol();   // or fetchValue() for a single scalar","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"/** Methods Select::__call actually proxies to the connection. */\nfunction isProxiedSelectMethod(string $method): bool\n{\n    return in_array($method, [\n        'fetchAffected', 'fetchAll', 'fetchAssoc', 'fetchCol', 'fetchGroup',\n        'fetchObject', 'fetchObjects', 'fetchOne', 'fetchPairs', 'fetchValue',\n    ], true);\n}\n\n// before a dynamic call:\nif (!isProxiedSelectMethod($method)) {\n    throw new LogicException(\"Select cannot proxy '{$method}'\");\n}\n$select->{$method}(...$args);","tryCatchPattern":null,"preventionTips":["Install Phalcon IDE stubs so autocompletion/static analysis flags unknown methods on Select","For dynamic dispatch, validate the method name against the ten fetch* proxies before calling","Treat UnknownQueryMethod (a BadMethodCallException subclass) as a build-time bug: fix it, do not catch it"],"tags":["php","phalcon","datamapper","select","magic-method","bad-method-call"],"backgroundTag":"undefined-method-call","analyzedSha":"b7419de9cd0a8a3f48441ead84c9f8415d463e25","analyzedAt":"2026-08-21T06:21:18.811Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}