瀏覽代碼

OpeningStore : ajout getOneToday()

packProduct
Guillaume 3 年之前
父節點
當前提交
448e5787d5
共有 2 個檔案被更改,包括 18 行新增0 行删除
  1. +11
    -0
      Repository/Section/OpeningRepositoryQuery.php
  2. +7
    -0
      Repository/Section/OpeningStore.php

+ 11
- 0
Repository/Section/OpeningRepositoryQuery.php 查看文件

@@ -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 查看文件

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

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

Loading…
取消
儲存