{"record":{"id":"2ab06d5271a95dfb","repo":"phalcon/cphalcon","slug":"no-action-directory-set-call-setactiondirectory","errorCode":null,"errorMessage":"No action directory set; call setActionDirectory().","messagePattern":"No action directory set; call setActionDirectory\\(\\)\\.","errorType":"exception","errorClass":"Phalcon\\ADR\\Exceptions\\ActionDirectoryNotSet","httpStatus":null,"severity":"error","filePath":"phalcon/ADR/Router/Router.zep","lineNumber":147,"sourceCode":"        if empty segments {\n            return this->baseNamespace . \"\\\\\" . verb;\n        }\n\n        for segment in segments {\n            let parts[] = this->camelize(segment);\n        }\n\n        return this->baseNamespace\n            . \"\\\\\" . implode(\"\\\\\", parts)\n            . \"\\\\\" . verb . implode(\"\", parts);\n    }\n\n    public function match(<RequestInterface> request) -> <RouterMatchInterface> | null\n    {\n        var path, method, located, other;\n\n        if this->actionDirectory === \"\" {\n            throw new ActionDirectoryNotSet();\n        }\n\n        let path   = request->getURI(true),\n            method = request->getMethod();\n\n        let located = this->locate(method, path);\n        if typeof located == \"array\" {\n            return new RouterMatch(\n                located[0],\n                located[1],\n                this->middlewareFor(located[0])\n            );\n        }\n\n        for other in this->verbs() {\n            if strcasecmp(other, method) !== 0 && typeof this->locate(other, path) == \"array\" {\n                throw new MethodNotAllowed();\n            }","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/ADR/Router/Router.zep#L129-L165","documentation":"QueryBuilderCursor throws InvalidBuilderInstance when the 'builder' config value exists but is not an instance of Phalcon\\Mvc\\Model\\Query\\Builder. A raw SQL string, a Phalcon\\Mvc\\Model\\Query\\Query object, a Resultset, or an array query definition all fail this instanceof check.","triggerScenarios":"Passing 'builder' => 'SELECT * FROM orders' (a PHQL/SQL string), an already-compiled Query object from getQuery(), or a resultset instead of the Builder itself.","commonSituations":"Confusing the Builder (fluent query definition) with the compiled Query; passing getQuery() output by mistake; porting code from components that accept query strings.","solutions":["Pass the Builder object itself — the value you call getQuery()/execute() on must NOT be pre-compiled.","Build one with $modelsManager->createBuilder()->from(Model::class)->where(...) or new Builder(['models' => Model::class, ...]).","If you only have PHQL text, wrap it: new Builder(['phql' => $phql]) produces a Builder."],"exampleFix":"// before\n$query = $builder->getQuery();\n$paginator = new QueryBuilderCursor(\n    [\n        'limit'        => 20,\n        'builder'      => $query, // Query object, not Builder\n        'cursorColumn' => 'id',\n    ]\n); // throws InvalidBuilderInstance\n\n// after\n$paginator = new QueryBuilderCursor(\n    [\n        'limit'        => 20,\n        'builder'      => $builder, // the Builder itself\n        'cursorColumn' => 'id',\n    ]\n);","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"function acceptsQueryBuilder(mixed $value): bool\n{\n    return $value instanceof \\Phalcon\\Mvc\\Model\\Query\\Builder;\n}\n\n// usage\nif (!acceptsQueryBuilder($config['builder'])) {\n    throw new \\InvalidArgumentException(\n        'Expected Phalcon\\\\Mvc\\\\Model\\\\Query\\\\Builder, got '\n        . get_debug_type($config['builder'])\n    );\n}","tryCatchPattern":null,"preventionTips":["Pass the Builder object itself — never the result of getQuery() or a PHQL string.","Type-hint helper methods against Phalcon\\Mvc\\Model\\Query\\Builder so misuse fails early."],"tags":["paginator","cursor","type-mismatch","querybuilder"],"backgroundTag":"wrong-parameter-type","analyzedSha":"b7419de9cd0a8a3f48441ead84c9f8415d463e25","analyzedAt":"2026-08-21T06:21:18.811Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}