We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

[2.0] Complex resultset throws error

I had a project that was running in 1.3.4, but since my upgrade yesterday to 2.0 all queries that need the complex resultset throw the following error:

0 Wrong number of parameters

TRACE

0 [internal function]: Phalcon\Mvc\Model\Resultset\Complex->__construct(NULL, Object(Communicator\Model\ComPara), Object(Phalcon\Db\Result\Pdo), NULL, false)

1 [internal function]: Phalcon\Mvc\Model\Query->_executeSelect(Array, Array, NULL)

2 [internal function]: Phalcon\Mvc\Model\Query->execute(Array, NULL)

3 /www/app/myModule/src/MyModule/Controller/FrontendController.php(99): Phalcon\Mvc\Model::find(Array)

4 [internal function]: MyModule\Controller\FrontendController->showAction()

5 [internal function]: Phalcon\Dispatcher->dispatch()

6 /www/public/index.php(103): Phalcon\Mvc\Application->handle()

7 {main}

Now, If I look at the IDE stub file for Phalcon\Mvc\Model\Resultset\Complex I see that the construct needs only 3 parameters, yet, according to the trace, 5 parameters are passed to the construct.

I'd really appreciate some help here because I'm seriously stuck. What am I not seeing?



1.3k
edited Apr '15

Ok,

but then how to explain the trace? And the fact that none of my queries (ORM or query builder) which were up and running in 1.3.4 work? All of them throwing the same error as the one above.

Maybe it's a similar issue then https://forum.phalcon.io/discussion/6342/namespace-in-query-builder-is-not-working-with-phalcon-20-but-it

I provisionally fixed problem.

In phalcon/mvc/model/resultset/complex.zep I change constructor like this:

// Before
public function __construct(var columnTypes, result, <BackendInterface> cache = null)
// After (added 2 optional args at the end)
public function __construct(var columnTypes, result, <BackendInterface> cache = null, dep = null, dep2 = null)

Then recompile phalcon and restart webserver. I really don't know what else it can cause, but it seems working. No more exception.