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 Doctrine\ORM\NoResultException; |
17
|
|
|
use Eccube\Common\EccubeConfig; |
18
|
|
|
use Eccube\Entity\Master\DeviceType; |
19
|
|
|
use Eccube\Entity\Page; |
20
|
|
|
use Symfony\Bridge\Doctrine\RegistryInterface; |
21
|
|
|
use Symfony\Component\DependencyInjection\ContainerInterface; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* PageRepository |
25
|
|
|
* |
26
|
|
|
* This class was generated by the Doctrine ORM. Add your own custom |
27
|
|
|
* repository methods below. |
28
|
|
|
*/ |
29
|
|
|
class PageRepository extends AbstractRepository |
30
|
|
|
{ |
31
|
|
|
/** |
32
|
|
|
* @var EccubeConfig |
33
|
|
|
*/ |
34
|
|
|
protected $eccubeConfig; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var string |
38
|
|
|
* @path %eccube_theme_user_data_dir% (app/template/user_data) |
39
|
|
|
*/ |
40
|
|
|
protected $userDataRealDir; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @var string |
44
|
|
|
* @path %eccube_theme_app_dir% (app/template) |
45
|
|
|
*/ |
46
|
|
|
protected $templateRealDir; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @var string |
50
|
|
|
* @path %eccube_theme_src_dir% (src/Eccube/Resource/template) |
51
|
|
|
*/ |
52
|
|
|
protected $templateDefaultRealDir; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* PageRepository constructor. |
56
|
|
|
* |
57
|
|
|
* @param RegistryInterface $registry |
58
|
|
|
* @param EccubeConfig $eccubeConfig |
59
|
|
|
* @param ContainerInterface $container |
60
|
|
|
*/ |
61
|
|
|
public function __construct(RegistryInterface $registry, EccubeConfig $eccubeConfig, ContainerInterface $container) |
62
|
|
|
{ |
63
|
|
|
parent::__construct($registry, Page::class); |
64
|
|
|
$this->eccubeConfig = $eccubeConfig; |
65
|
|
|
$this->userDataRealDir = $container->getParameter('eccube_theme_user_data_dir'); |
66
|
|
|
$this->templateRealDir = $container->getParameter('eccube_theme_app_dir'); |
67
|
|
|
$this->templateDefaultRealDir = $container->getParameter('eccube_theme_src_dir'); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @param string $url |
72
|
|
|
* |
73
|
|
|
* @return Page |
74
|
|
|
* |
75
|
|
|
* @throws NoResultException |
76
|
|
|
* @throws \Doctrine\ORM\NonUniqueResultException |
77
|
|
|
*/ |
78
|
|
|
public function getByUrl($url) |
79
|
|
|
{ |
80
|
|
|
$qb = $this->createQueryBuilder('p'); |
81
|
|
|
$Page = $qb->select('p') |
82
|
|
|
->where('p.url = :route') |
83
|
|
|
->setParameter('route', $url) |
84
|
|
|
->getQuery() |
85
|
|
|
->useResultCache(true, $this->getCacheLifetime()) |
86
|
|
|
->getSingleResult(); |
87
|
|
|
|
88
|
|
|
return $Page; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @return Page |
93
|
|
|
*/ |
94
|
|
|
public function newPage() |
95
|
|
|
{ |
96
|
|
|
$Page = new \Eccube\Entity\Page(); |
97
|
|
|
$Page->setEditType(Page::EDIT_TYPE_USER); |
98
|
|
|
|
99
|
|
|
return $Page; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* ページの属性を取得する. |
104
|
|
|
* |
105
|
|
|
* この関数は, dtb_Page の情報を検索する. |
106
|
|
|
* |
107
|
|
|
* @param string $where 追加の検索条件 |
108
|
|
|
* @param string[] $parameters 追加の検索パラメーター |
109
|
|
|
* |
110
|
|
|
* @return array ページ属性の配列 |
111
|
|
|
*/ |
112
|
|
|
public function getPageList($where = null, $parameters = []) |
113
|
|
|
{ |
114
|
|
|
$qb = $this->createQueryBuilder('p') |
115
|
|
|
->andWhere('p.id <> 0') |
116
|
|
|
->andWhere('p.MasterPage is null') |
117
|
|
|
->orderBy('p.id', 'ASC'); |
118
|
|
|
if (!is_null($where)) { |
119
|
|
|
$qb->andWhere($where); |
120
|
|
|
foreach ($parameters as $key => $val) { |
121
|
|
|
$qb->setParameter($key, $val); |
122
|
|
|
} |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
$Pages = $qb |
126
|
|
|
->getQuery() |
127
|
|
|
->getResult(); |
128
|
|
|
|
129
|
|
|
return $Pages; |
130
|
|
|
} |
131
|
|
|
} |
132
|
|
|
|