Describe the bug
QueryBuilder Paginator generate notice during paginate() call. Inside travis build.
PHP Notice: Undefined index: di in /home/travis/build/phalcon/vokuro/src/Controllers/UsersController.php on line 59
To Reproduce
Steps to reproduce the behavior:
Criteria::fromInput()Phalcon\Paginator\Adapter\QueryBuilder$paginator->paginate()Provide minimal script to reproduce the issue
use Phalcon\Mvc\Model\Criteria;
use Phalcon\Paginator\Adapter\QueryBuilder as Paginator;
use Vokuro\Models\Users;
$builder = Criteria::fromInput($this->getDI(), Users::class, $this->request->getQuery());
$paginator = new Paginator([
'builder' => $builder->createBuilder(),
'limit' => 10,
'page' => $this->request->getQuery('page', 'int', 1),
]);
$this->view->setVar('page', $paginator->paginate()); // Here is PHP Notice
Expected behavior
Code runs without PHP Norice.
Details
Additional context
https://travis-ci.com/phalcon/vokuro/jobs/269569381#L681
Resolved
This is still happening BTW. This is not resolved. I get the errors when accessing the data from a view variable that is set with:
$this->view->setVar('example','Example::findFirst(['blah_blah_opts'])
This view var is set AFTER I paginate(); the Model. I am using the Model Adapter for this. Running almost identical server setup as described in OP's ticket.
@eklect Are you using the latest Phalcon? This was addressed in 4.0.1 from what I see.
I currently am running 4.0.5
@eklect I tried reproducing this but am not having much luck.
I created this test based on the input of this issue:
And the tests pass just fine:
https://github.com/niden/cphalcon/runs/511189972?check_suite_focus=true
(you can expand the MySQL test run - you will see it's all green).
Any more input you can offer?
My bug I saw wasn't on the QueryBuilder Adapter, but on the Model adapter. I was experiencing the same issues but on a different adapter. My suspicion is that the QueryBuilder bug was fixed, but there might be one on the Model Adapter? That's about as far as I got on troubleshooting it before writing a "quick & dirty" workaround.
Gotcha. I will write a test for the model one and see if I get a fail on it.
@eklect No luck in reproducing it
Ok Thanks for looking into that for me @niden . Appreciate the help greatly. Thank you again for all your hard work! Phalcon is my absolute fav!
Closing this