Show audios in reverse order

This commit is contained in:
lalka2018 2023-11-14 15:16:37 +03:00
parent 2ea91360c8
commit 1f340e392f

View file

@ -77,7 +77,7 @@ class Audios
function getByEntityID(int $entity, int $offset = 0, ?int $limit = NULL, ?int& $deleted = nullptr): \Traversable function getByEntityID(int $entity, int $offset = 0, ?int $limit = NULL, ?int& $deleted = nullptr): \Traversable
{ {
$limit ??= OPENVK_DEFAULT_PER_PAGE; $limit ??= OPENVK_DEFAULT_PER_PAGE;
$iter = $this->rels->where("entity", $entity)->limit($limit, $offset); $iter = $this->rels->where("entity", $entity)->limit($limit, $offset)->order("index DESC");
foreach($iter as $rel) { foreach($iter as $rel) {
$audio = $this->get($rel->audio); $audio = $this->get($rel->audio);
if(!$audio || $audio->isDeleted()) { if(!$audio || $audio->isDeleted()) {