I'm using QueryBuilder for my pagination. First I have to create the Builder, and I do so with this:
$Builder = $this->modelsManager->createBuilder()
->from('\Pay\Model\Transaction')
->orderBy('id DESC');
However, when I do that I get this error:
Phalcon Exception: Column 'id' doesn't belong to any of the selected models (2), when preparing: SELECT [\Pay\Model\Transaction].* FROM [\Pay\Model\Transaction] ORDER BY id DESC LIMIT 10
When I remove that orderBy() clause, everything works fine. I can then output all my Transactions - even the "id" of each Transaction. Am I missing some way of specifying the columns available to Transaction?
Edit: The problem was the leading slash in "\Pay\Model\Transaction". While it is valid PHP syntax, PHQL must parse it differently.