1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Superdesk Web Publisher Core Bundle. |
5
|
|
|
* |
6
|
|
|
* Copyright 2016 Sourcefabric z.ú. and contributors. |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please see the |
9
|
|
|
* AUTHORS and LICENSE files distributed with this source code. |
10
|
|
|
* |
11
|
|
|
* @copyright 2016 Sourcefabric z.ú |
12
|
|
|
* @license http://www.superdesk.org/license |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
namespace SWP\Bundle\CoreBundle\Model; |
16
|
|
|
|
17
|
|
|
use SWP\Bundle\ContentBundle\Model\RouteInterface; |
18
|
|
|
use SWP\Component\MultiTenancy\Model\Tenant as BaseTenant; |
19
|
|
|
use SWP\Component\OutputChannel\Model\OutputChannelAwareInterface; |
20
|
|
|
use SWP\Component\OutputChannel\Model\OutputChannelInterface as BaseOutputChannelInterface; |
21
|
|
|
|
22
|
|
|
class Tenant extends BaseTenant implements TenantInterface, ArticlesCountInterface, OutputChannelAwareInterface |
23
|
|
|
{ |
24
|
|
|
use ArticlesCountTrait; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @var string |
28
|
|
|
*/ |
29
|
|
|
protected $themeName; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @var RouteInterface |
33
|
|
|
*/ |
34
|
|
|
protected $homepage; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var bool |
38
|
|
|
*/ |
39
|
|
|
protected $ampEnabled = false; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @var BaseOutputChannelInterface|null |
43
|
|
|
*/ |
44
|
|
|
protected $outputChannel; |
45
|
44 |
|
|
46
|
|
|
/** @var AppleNewsConfig|null */ |
47
|
44 |
|
protected $appleNewsConfig; |
48
|
|
|
|
49
|
|
|
protected ?PWAConfig $pwaConfig = null; |
|
|
|
|
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* {@inheritdoc} |
53
|
104 |
|
*/ |
54
|
|
|
public function getThemeName() |
55
|
104 |
|
{ |
56
|
104 |
|
return $this->themeName; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* {@inheritdoc} |
61
|
2 |
|
*/ |
62
|
|
|
public function setThemeName($themeName) |
63
|
2 |
|
{ |
64
|
|
|
$this->themeName = $themeName; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* {@inheritdoc} |
69
|
104 |
|
*/ |
70
|
|
|
public function getHomepage() |
71
|
104 |
|
{ |
72
|
104 |
|
return $this->homepage; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* {@inheritdoc} |
77
|
7 |
|
*/ |
78
|
|
|
public function setHomepage(RouteInterface $homepage) |
79
|
7 |
|
{ |
80
|
|
|
$this->homepage = $homepage; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* {@inheritdoc} |
85
|
1 |
|
*/ |
86
|
|
|
public function isAmpEnabled(): bool |
87
|
1 |
|
{ |
88
|
1 |
|
return $this->ampEnabled; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* {@inheritdoc} |
93
|
8 |
|
*/ |
94
|
|
|
public function setAmpEnabled(bool $ampEnabled) |
95
|
8 |
|
{ |
96
|
|
|
$this->ampEnabled = $ampEnabled; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* {@inheritdoc} |
101
|
104 |
|
*/ |
102
|
|
|
public function getOutputChannel(): ?BaseOutputChannelInterface |
103
|
104 |
|
{ |
104
|
104 |
|
return $this->outputChannel; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* {@inheritdoc} |
109
|
|
|
*/ |
110
|
|
|
public function setOutputChannel(?BaseOutputChannelInterface $outputChannel): void |
111
|
|
|
{ |
112
|
|
|
$this->outputChannel = $outputChannel; |
113
|
|
|
|
114
|
|
|
if ($outputChannel instanceof OutputChannelInterface) { |
115
|
|
|
$outputChannel->setTenant($this); |
116
|
|
|
} |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
public function getAppleNewsConfig(): ?AppleNewsConfig |
120
|
|
|
{ |
121
|
|
|
return $this->appleNewsConfig; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
public function setAppleNewsConfig(?AppleNewsConfig $appleNewsConfig): void |
125
|
|
|
{ |
126
|
|
|
if ($appleNewsConfig instanceof AppleNewsConfig) { |
127
|
|
|
$appleNewsConfig->setTenant($this); |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
$this->appleNewsConfig = $appleNewsConfig; |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* @return PWAConfig |
135
|
|
|
*/ |
136
|
|
|
public function getPwaConfig(): ?PWAConfig |
137
|
|
|
{ |
138
|
|
|
return $this->pwaConfig; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* @param PWAConfig $pwaConfig |
143
|
|
|
*/ |
144
|
|
|
public function setPwaConfig(?PWAConfig $pwaConfig): void |
145
|
|
|
{ |
146
|
|
|
$this->pwaConfig = $pwaConfig; |
147
|
|
|
} |
148
|
|
|
} |
149
|
|
|
|