Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Exception when using QueryBuilder & Pagination

I'm building a query with QueryBuilder, then using it as the data source for the Paginator, like so

$Builder = $this->modelsManager->createBuilder()

$Paginator = new \Phalcon\Paginator\Adapter\QueryBuilder([

The exception being raised is:

Can't obtain the model 'entereddate' source from the _models list, when preparing: SELECT [\OB\Model\Request].* FROM [\OB\Model\Request] ORDER BY entereddate LIMIT 2

When I remove the ->orderBy("entered_date") clause, everything works fine. I know entered_date is an actual property of the \OB\Model\Request class because I can output it in my view. In fact, this exception gets raised regardless of the field name I order by.

Any idea what this exception means?


Removing the \ from from('\OB\Model\Request') does help?

Yep, that fixed it. But wow - that's an obscure fix. Why doesn't the ORM remove leading slashes?