1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of EC-CUBE |
5
|
|
|
* |
6
|
|
|
* Copyright(c) LOCKON CO.,LTD. All Rights Reserved. |
7
|
|
|
* |
8
|
|
|
* http://www.lockon.co.jp/ |
9
|
|
|
* |
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
11
|
|
|
* file that was distributed with this source code. |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace Eccube\Repository; |
15
|
|
|
|
16
|
|
|
use Eccube\Common\EccubeConfig; |
17
|
|
|
use Eccube\Entity\Block; |
18
|
|
|
use Eccube\Entity\Master\DeviceType; |
19
|
|
|
use Symfony\Bridge\Doctrine\RegistryInterface; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* BlocRepository |
23
|
|
|
* |
24
|
|
|
* This class was generated by the Doctrine ORM. Add your own custom |
25
|
|
|
* repository methods below. |
26
|
|
|
*/ |
27
|
|
|
class BlockRepository extends AbstractRepository |
28
|
|
|
{ |
29
|
|
|
/** |
30
|
|
|
* @var EccubeConfig |
31
|
|
|
*/ |
32
|
|
|
protected $eccubeConfig; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* BlockRepository constructor. |
36
|
|
|
* |
37
|
|
|
* @param RegistryInterface $registry |
38
|
|
|
* @param EccubeConfig $eccubeConfig |
39
|
|
|
*/ |
40
|
|
|
public function __construct( |
41
|
|
|
RegistryInterface $registry, |
42
|
|
|
EccubeConfig $eccubeConfig |
43
|
|
|
) { |
44
|
|
|
parent::__construct($registry, Block::class); |
45
|
|
|
$this->eccubeConfig = $eccubeConfig; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
public function newBlock($DeviceType) |
49
|
|
|
{ |
50
|
|
|
$Block = new \Eccube\Entity\Block(); |
51
|
|
|
$Block |
52
|
|
|
->setDeviceType($DeviceType) |
53
|
|
|
->setUseController(false) |
54
|
|
|
->setDeletable(true); |
55
|
|
|
|
56
|
|
|
return $Block; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* ブロック一覧の取得. |
61
|
|
|
* |
62
|
|
|
* @param \Eccube\Entity\Master\DeviceType $DeviceType |
63
|
|
|
* |
64
|
|
|
* @return null|\Symfony\Component\HttpFoundation\Request |
65
|
|
|
*/ |
66
|
|
|
public function getList($DeviceType) |
67
|
|
|
{ |
68
|
|
|
$qb = $this->createQueryBuilder('b') |
69
|
|
|
->orderBy('b.id', 'DESC') |
70
|
|
|
->where('b.DeviceType = :DeviceType') |
71
|
|
|
->setParameter('DeviceType', $DeviceType); |
72
|
|
|
|
73
|
|
|
$Blocks = $qb |
74
|
|
|
->getQuery() |
75
|
|
|
->getResult(); |
76
|
|
|
|
77
|
|
|
return $Blocks; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* 未設定のブロックを取得 |
82
|
|
|
* |
83
|
|
|
* @param Ecube\Entity\Block[] $Blocks |
84
|
|
|
* |
85
|
|
|
* @return null|Ecube\Entity\Block[] |
86
|
|
|
*/ |
87
|
|
|
public function getUnusedBlocks($Blocks) |
88
|
|
|
{ |
89
|
|
|
$UnusedBlocks = $this->createQueryBuilder('b') |
90
|
|
|
->select('b') |
91
|
|
|
->where('b not in (:blocks)') |
92
|
|
|
->setParameter('blocks', $Blocks) |
93
|
|
|
->getQuery() |
94
|
|
|
->getResult(); |
95
|
|
|
|
96
|
|
|
return $UnusedBlocks; |
97
|
|
|
} |
98
|
|
|
} |
99
|
|
|
|