Open charlesswanson opened 7 years ago
There is nothing similar in Spot, but you could write a class that makes use of a Spot Query.
Spot aims to be a more lightweight alternative. So, I don't think that kind of class would make it to the core.
You can paginate your query yourself using limit()
, offset()
and count()
Which seems a strange asnwer, because I have this working in my code:
if ($limit)
{
$result = $this->where($aFilter)
->order(['name' => 'ASC'])
->limit($limit, $offset);
}
else
{
$result = $this->where($aFilter)
->order(['name' => 'ASC']);
}
@marcelloh Which is exactly what @nebulousGirl answered.
You can paginate your query yourself using limit(), offset() and count()
Question was if Spot has is a Doctrine style paginator. Which Spot does not have.
Honestly I would not be opposed to a simplistic Pagination class that uses the built-in limit()
offset()
and count()
methods to make things easier.
I did something like that a while ago.
Personally I do not think this belongs in core. However thanks to being an organisation we could make something like spotorm/paginator
.
I have a select query which limits the results to a count of 10. In raw mysqli, I can have
"SELECT SQL_CALC_FOUND_ROWS * FROM table WHERE condition LIMIT 0,10"
, then perform another query to know how many total rows matched.SELECT FOUND_ROWS() as foundrows
It looks like doctrine supports something similar: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/tutorials/pagination.html
Is this possible with spot2?
Thanks