Kaynağa Gözat

[Administration] Tableau de bord : affichage des abonnements modifiés récemment

feature/souke
Guillaume Bourgeois 11 ay önce
ebeveyn
işleme
6fc9ad0f67
2 değiştirilmiş dosya ile 4 ekleme ve 11 silme
  1. +1
    -2
      common/logic/Subscription/Subscription/Repository/SubscriptionRepository.php
  2. +3
    -9
      common/logic/Subscription/Subscription/Repository/SubscriptionRepositoryQuery.php

+ 1
- 2
common/logic/Subscription/Subscription/Repository/SubscriptionRepository.php Dosyayı Görüntüle

@@ -71,8 +71,7 @@ class SubscriptionRepository extends AbstractRepository
public function findSubscriptionsLatestAdded()
{
return $this->createDefaultQuery()
->filterByCreatedDuringPastWeek()
->filterByCreatedByUser()
->filterByCreatedOrUpdatedByUserDuringPastWeek()
->find();
}
}

+ 3
- 9
common/logic/Subscription/Subscription/Repository/SubscriptionRepositoryQuery.php Dosyayı Görüntüle

@@ -21,17 +21,11 @@ class SubscriptionRepositoryQuery extends AbstractRepositoryQuery
return $this;
}

public function filterByCreatedDuringPastWeek(): self
public function filterByCreatedOrUpdatedByUserDuringPastWeek(): self
{
$datePastWeek = new \DateTime('-7 days');
$this->andWhere('subscription.created_at >= :created_at')
->addParams(['created_at' => $datePastWeek->format('Y-m-d H:i:s')]);
return $this;
}

public function filterByCreatedByUser(): self
{
$this->andWhere('subscription.id_user = subscription.id_created_by');
$this->andWhere('(subscription.id_user = subscription.id_created_by AND subscription.created_at >= :date_past_week) OR (subscription.id_user = subscription.id_updated_by AND subscription.updated_at >= :date_past_week)')
->addParams(['date_past_week' => $datePastWeek->format('Y-m-d H:i:s')]);
return $this;
}
}

Yükleniyor…
İptal
Kaydet