Bladeren bron

OpeningStore : ajout getOneToday()

packProduct
Guillaume 3 jaren geleden
bovenliggende
commit
448e5787d5
2 gewijzigde bestanden met toevoegingen van 18 en 0 verwijderingen
  1. +11
    -0
      Repository/Section/OpeningRepositoryQuery.php
  2. +7
    -0
      Repository/Section/OpeningStore.php

+ 11
- 0
Repository/Section/OpeningRepositoryQuery.php Bestand weergeven

@@ -14,4 +14,15 @@ class OpeningRepositoryQuery extends AbstractRepositoryQuery
{
parent::__construct($repository, 'opening', $paginator);
}

public function filterByToday()
{
return $this->filterByDay(date('N'));
}

public function filterByDay(int $day)
{
return $this->andWhereEqual('day', $day);
}

}

+ 7
- 0
Repository/Section/OpeningStore.php Bestand weergeven

@@ -33,4 +33,11 @@ class OpeningStore extends AbstractStore
{
return $query;
}

public function getOneToday($query = null)
{
$query = $this->createDefaultQuery($query);
$query->filterByToday();
return $query->findOne();
}
}

Laden…
Annuleren
Opslaan