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

Phalcon ORM limits

Hello,

Im using Phalcon ORM to get data from my MySQL database. For some reason im getting error :

Very simple query looks like this:

    $cars = Cars::find();

And this is the error i got.

    {
    "status": "error",
    "http_code": 500,
    "message": "The index does not exist in the cursor",
    "data": null
    }

For some reason, there is no error when i have low number of data in my database ... etc. 10 cars .. This error come when I import more data in database .. I fixed it atm with setting limits on my Query on 50 cars and its working .. But is this a normal solution or there is a bether one?

I dont have such a problem. Write about your system more. What adapter you are using ? What OS ? What php version and phalcon version ? And what MySQL version ?



23.6k
edited Mar '16

I dont have such a problem. Write about your system more. What adapter you are using ? What OS ? What php version and phalcon version ? And what MySQL version ?

Well here is some info:

  • PHP Version 5.4.16
  • 5.5.44-MariaDB
  • CentOS 7.1 x64
  • Phalcon 2.0.8

And im uisng:

  • Phalcon\Db\Adapter\Pdo\Mysql

So here is an example that i just tested... Lets say i have 100 cars in my db .. If i use :

    $cars = Cars::find();

It will give the error that I have wrote ... But If use this, api will give me status 200 and show data, work perfectly:

    $cars = Cars::find(
        array(
            'limit' => 99
            )
        );

Also my api give status code 200 on empty tables .. so it works fine witouth data in db.

Well not sure what's going on. How about updating php to 5.6 ? But dont know if this fix your problem. I have like many more records in db and can find all without any problem.



23.6k

Well not sure what's going on. How about updating php to 5.6 ? But dont know if this fix your problem. I have like many more records in db and can find all without any problem.

Looks like model have some limits or idk... not sure why this is happening.

Write about it on github bacause it's a bug. Its not model limits or anything.

@Armin how much of columns the cars table has? And please copy/paste Cars model.

edited May '16

Check your php.ini setup. Pay special attention to memory limits. I can bet that data set returned by RDBMS is too large to fit into PHP memory with your current setup. Also, provide full exception stack trace, since nicely formatted message is an abstraction by your API. It might be that API imposes some limits too, if you don't have control over it? And provide real numbers - or that's what you already did? With 100 records you crash entire stack, and with 99 everything is working fine?