Explorar el Código

OpeningStore : ajout getOneToday()

packProduct
Guillaume hace 3 años
padre
commit
448e5787d5
Se han modificado 2 ficheros con 18 adiciones y 0 borrados
  1. +11
    -0
      Repository/Section/OpeningRepositoryQuery.php
  2. +7
    -0
      Repository/Section/OpeningStore.php

+ 11
- 0
Repository/Section/OpeningRepositoryQuery.php Ver fichero

@@ -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 Ver fichero

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

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

Cargando…
Cancelar
Guardar