From 30727b801dcb79fdbc4caef9e1f151da5765e03b Mon Sep 17 00:00:00 2001 From: lalka2016 <99399973+lalka2016@users.noreply.github.com> Date: Mon, 18 Sep 2023 17:47:19 +0300 Subject: [PATCH] fix gifts pagination --- Web/Models/Repositories/Gifts.php | 6 ++++++ Web/Presenters/GiftsPresenter.php | 1 + 2 files changed, 7 insertions(+) diff --git a/Web/Models/Repositories/Gifts.php b/Web/Models/Repositories/Gifts.php index f36b82a5..3baa2397 100644 --- a/Web/Models/Repositories/Gifts.php +++ b/Web/Models/Repositories/Gifts.php @@ -42,4 +42,10 @@ class Gifts foreach($cats as $cat) yield new GiftCategory($cat); } + + function getCategoriesCount(): int + { + $cats = $this->cats->where("deleted", false); + return $cats->count(); + } } diff --git a/Web/Presenters/GiftsPresenter.php b/Web/Presenters/GiftsPresenter.php index 71480540..39359add 100644 --- a/Web/Presenters/GiftsPresenter.php +++ b/Web/Presenters/GiftsPresenter.php @@ -41,6 +41,7 @@ final class GiftsPresenter extends OpenVKPresenter $this->template->user = $user; $this->template->iterator = $cats; + $this->template->count = $this->gifts->getCategoriesCount(); $this->template->_template = "Gifts/Menu.xml"; }