|
- <?php
-
- namespace Lc\CaracoleBundle\Repository\Reminder;
-
- use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
- use Lc\CaracoleBundle\Repository\SectionStoreTrait;
- use Lc\SovBundle\Model\User\UserInterface;
- use Lc\SovBundle\Repository\Reminder\ReminderStore as SovReminderStore;
-
- class ReminderStore extends SovReminderStore
- {
- use SectionStoreTrait;
- use MerchantStoreTrait;
-
- public function get($params = [], $query = null)
- {
- if (is_null($query)) {
- $query = $this->query->create();
- }
-
- if ($this->merchant) {
- $query->filterByMerchant($this->merchant);
- }
-
- if ($this->section) {
- $query->filterBySection($this->section);
- }
-
- return parent::get($params, $query);
- }
-
- public function getByUser(UserInterface $user, $query = null): array
- {
- if (is_null($query)) {
- $query = $this->query->create();
- }
-
- if ($this->merchant) {
- $query->filterByMerchant($this->merchant);
- }
-
- return parent::getByUser($user, $query);
- }
-
- public function getByEasyAdminConfigAndUser(
- string $crudAction,
- string $crudControllerFqcn,
- UserInterface $user,
- int $entityId = null,
- $query = null
- ): array {
- if (is_null($query)) {
- $query = $this->query->create();
- }
-
- if ($this->merchant) {
- $query->filterByMerchant($this->merchant);
- }
-
- return parent::getByEasyAdminConfigAndUser($crudAction, $crudControllerFqcn, $user, $entityId, $query);
- }
- }
|