Closed controlnocontrol closed 6 years ago
It is not really a framework, more like a skeleton which can be used for starting new projects. Reading through Zend docs you are correct. TableGateway
seems to require a Select
object to pass in ORDER BY
clause. One way to achieve this would be to alter the all() method in ZendTodoRepository
. Something like:
public function all(array $specification = []): array
{
$select = /* Build $select from $specification here. */
$rowset = $this->table->selectWith($select);
return map($rowset, function ($row) {
return $this->hydrator->hydrate((array) $row, new Todo);
});
}
Ok awesome that's what I'll be doing. Was just wondering whether you had that covered. Thanks!
I just recently converted this to Zend TableGateway and have not needed an ORDER BY
query yet by myself. But since it is common use case I should find a good way to do it. Or at least mention this in docs.
Thanks for the heads up!
I'm looking at the
zend-db
documentation and they indicate thatORDER BY
is achieved with something like:Your
ZendTodoRepository
all
function seems to always expect an array. Was your framework set up withORDER BY
in mind? How can we achieve this?