1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* This file is part of EC-CUBE |
4
|
|
|
* |
5
|
|
|
* Copyright(c) 2000-2015 LOCKON CO.,LTD. All Rights Reserved. |
6
|
|
|
* |
7
|
|
|
* http://www.lockon.co.jp/ |
8
|
|
|
* |
9
|
|
|
* This program is free software; you can redistribute it and/or |
10
|
|
|
* modify it under the terms of the GNU General Public License |
11
|
|
|
* as published by the Free Software Foundation; either version 2 |
12
|
|
|
* of the License, or (at your option) any later version. |
13
|
|
|
* |
14
|
|
|
* This program is distributed in the hope that it will be useful, |
15
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
16
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17
|
|
|
* GNU General Public License for more details. |
18
|
|
|
* |
19
|
|
|
* You should have received a copy of the GNU General Public License |
20
|
|
|
* along with this program; if not, write to the Free Software |
21
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
22
|
|
|
*/ |
23
|
|
|
|
24
|
|
|
|
25
|
|
|
namespace Eccube\Repository\Master; |
26
|
|
|
|
27
|
|
|
use Doctrine\ORM\EntityRepository; |
28
|
|
|
use Doctrine\ORM\Query; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* OrderStatusRepository |
32
|
|
|
* |
33
|
|
|
* This class was generated by the Doctrine ORM. Add your own custom |
34
|
|
|
* repository methods below. |
35
|
|
|
*/ |
36
|
|
|
class OrderStatusRepository extends EntityRepository |
37
|
|
|
{ |
38
|
|
|
/** |
39
|
|
|
* NOT IN で検索する. |
40
|
|
|
* |
41
|
|
|
* TODO Abstract メソッドにしたい |
42
|
|
|
* |
43
|
|
|
* @param array $criteria |
44
|
|
|
* @param array $orderBy |
45
|
|
|
* @param integer $limit |
46
|
|
|
* @param integer $offset |
47
|
|
|
* @return array |
48
|
|
|
* @see EntityRepository::findBy() |
49
|
|
|
*/ |
50
|
|
|
public function findNotContainsBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) |
51
|
|
|
{ |
52
|
|
|
$qb = $this->createQueryBuilder('o'); |
53
|
|
|
|
54
|
|
|
foreach ($criteria as $col => $val) { |
55
|
|
|
$qb->andWhere($qb->expr()->notIn('o.'.$col, ':'.$col)) |
56
|
|
|
->setParameter($col, (array)$val); |
|
|
|
|
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
if (is_array($orderBy)) { |
60
|
|
|
foreach ($orderBy as $sort => $order) { |
61
|
|
|
if (array_values($orderBy) === $orderBy) { // 配列 or 連想配列 |
62
|
|
|
$sort = $order; |
63
|
|
|
$order = 'ASC'; |
64
|
|
|
} |
65
|
|
|
$qb->orderBy('o.'.$sort, $order); |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
if ($limit > 0) { |
70
|
|
|
$qb->setMaxResults($limit); |
71
|
|
|
} |
72
|
|
|
if ($offset > 0) { |
73
|
|
|
$qb->setFirstResult($offset); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
return $qb->getQuery()->getResult(); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
public function findAllArray() |
80
|
|
|
{ |
81
|
|
|
|
82
|
|
|
$query = $this |
83
|
|
|
->getEntityManager() |
84
|
|
|
->createQuery('SELECT os FROM Eccube\Entity\Master\OrderStatus os INDEX BY os.id ORDER BY os.rank ASC') |
85
|
|
|
; |
86
|
|
|
$result = $query |
87
|
|
|
->getResult(Query::HYDRATE_ARRAY) |
88
|
|
|
; |
89
|
|
|
|
90
|
|
|
return $result; |
91
|
|
|
|
92
|
|
|
} |
93
|
|
|
} |
94
|
|
|
|