|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of Sulu. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Sulu GmbH |
|
7
|
|
|
* |
|
8
|
|
|
* This source file is subject to the MIT license that is bundled |
|
9
|
|
|
* with this source code in the file LICENSE. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Sulu\Bundle\ArticleBundle\Content; |
|
13
|
|
|
|
|
14
|
|
|
use Sulu\Bundle\ArticleBundle\Document\ArticleDocument; |
|
15
|
|
|
use Sulu\Bundle\ArticleBundle\Document\ArticleViewDocumentInterface; |
|
16
|
|
|
use Sulu\Bundle\ArticleBundle\Document\ExcerptViewObject; |
|
17
|
|
|
use Sulu\Bundle\ArticleBundle\Document\SeoViewObject; |
|
18
|
|
|
use Sulu\Component\SmartContent\ResourceItemInterface; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* Represents a resource-item for smart-content data-provider. |
|
22
|
|
|
*/ |
|
23
|
|
|
class ArticleResourceItem implements ResourceItemInterface |
|
24
|
|
|
{ |
|
25
|
|
|
/** |
|
26
|
|
|
* @var ArticleViewDocumentInterface |
|
27
|
|
|
*/ |
|
28
|
|
|
private $article; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* @var ArticleDocument |
|
32
|
|
|
*/ |
|
33
|
|
|
private $resource; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @param ArticleViewDocumentInterface $article |
|
37
|
|
|
* @param ArticleDocument $resource |
|
38
|
|
|
*/ |
|
39
|
6 |
|
public function __construct(ArticleViewDocumentInterface $article, ArticleDocument $resource) |
|
40
|
|
|
{ |
|
41
|
6 |
|
$this->article = $article; |
|
42
|
6 |
|
$this->resource = $resource; |
|
43
|
6 |
|
} |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* Returns uuid. |
|
47
|
|
|
* |
|
48
|
|
|
* @return string |
|
49
|
|
|
*/ |
|
50
|
1 |
|
public function getUuid() |
|
51
|
|
|
{ |
|
52
|
1 |
|
return $this->article->getUuid(); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* Returns locale. |
|
57
|
|
|
* |
|
58
|
|
|
* @return string |
|
59
|
|
|
*/ |
|
60
|
|
|
public function getLocale() |
|
61
|
|
|
{ |
|
62
|
|
|
return $this->article->getLocale(); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* Returns title. |
|
67
|
|
|
* |
|
68
|
|
|
* @return string |
|
69
|
|
|
*/ |
|
70
|
1 |
|
public function getTitle() |
|
71
|
|
|
{ |
|
72
|
1 |
|
return $this->article->getTitle(); |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* Returns type. |
|
77
|
|
|
* |
|
78
|
|
|
* @return string |
|
79
|
|
|
*/ |
|
80
|
|
|
public function getType() |
|
81
|
|
|
{ |
|
82
|
|
|
return $this->article->getType(); |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* Returns changer. |
|
87
|
|
|
* |
|
88
|
|
|
* @return string |
|
89
|
|
|
*/ |
|
90
|
|
|
public function getChanger() |
|
91
|
|
|
{ |
|
92
|
|
|
return $this->article->getChangerFullName(); |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
/** |
|
96
|
|
|
* Returns creator. |
|
97
|
|
|
* |
|
98
|
|
|
* @return string |
|
99
|
|
|
*/ |
|
100
|
|
|
public function getCreator() |
|
101
|
|
|
{ |
|
102
|
|
|
return $this->article->getCreatorFullName(); |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
|
|
/** |
|
106
|
|
|
* Return changed. |
|
107
|
|
|
* |
|
108
|
|
|
* @return \DateTime |
|
109
|
|
|
*/ |
|
110
|
|
|
public function getChanged() |
|
111
|
|
|
{ |
|
112
|
|
|
return $this->article->getChanged(); |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
/** |
|
116
|
|
|
* Returns created. |
|
117
|
|
|
* |
|
118
|
|
|
* @return \DateTime |
|
119
|
|
|
*/ |
|
120
|
|
|
public function getCreated() |
|
121
|
|
|
{ |
|
122
|
|
|
return $this->article->getCreated(); |
|
123
|
|
|
} |
|
124
|
|
|
|
|
125
|
|
|
/** |
|
126
|
|
|
* Returns published. |
|
127
|
|
|
* |
|
128
|
|
|
* @return \DateTime |
|
129
|
|
|
*/ |
|
130
|
|
|
public function getPublished() |
|
131
|
|
|
{ |
|
132
|
|
|
return $this->article->getPublished(); |
|
133
|
|
|
} |
|
134
|
|
|
|
|
135
|
|
|
/** |
|
136
|
|
|
* Returns authored. |
|
137
|
|
|
* |
|
138
|
|
|
* @return \DateTime |
|
139
|
|
|
*/ |
|
140
|
|
|
public function getAuthored() |
|
141
|
|
|
{ |
|
142
|
|
|
return $this->article->getAuthored(); |
|
143
|
|
|
} |
|
144
|
|
|
|
|
145
|
|
|
/** |
|
146
|
|
|
* Returns excerpt. |
|
147
|
|
|
* |
|
148
|
|
|
* @return ExcerptViewObject |
|
149
|
|
|
*/ |
|
150
|
|
|
public function getExcerpt() |
|
151
|
|
|
{ |
|
152
|
|
|
return $this->article->getExcerpt(); |
|
153
|
|
|
} |
|
154
|
|
|
|
|
155
|
|
|
/** |
|
156
|
|
|
* Returns seo. |
|
157
|
|
|
* |
|
158
|
|
|
* @return SeoViewObject |
|
159
|
|
|
*/ |
|
160
|
|
|
public function getSeo() |
|
161
|
|
|
{ |
|
162
|
|
|
return $this->article->getSeo(); |
|
163
|
|
|
} |
|
164
|
|
|
|
|
165
|
|
|
/** |
|
166
|
|
|
* Returns route-path. |
|
167
|
|
|
* |
|
168
|
|
|
* @return string |
|
169
|
|
|
*/ |
|
170
|
|
|
public function getRoutePath() |
|
171
|
|
|
{ |
|
172
|
|
|
return $this->article->getRoutePath(); |
|
173
|
|
|
} |
|
174
|
|
|
|
|
175
|
|
|
/** |
|
176
|
|
|
* Returns view-object. |
|
177
|
|
|
* |
|
178
|
|
|
* @return ArticleViewDocumentInterface |
|
179
|
|
|
*/ |
|
180
|
|
|
public function getContent() |
|
181
|
|
|
{ |
|
182
|
|
|
return $this->article; |
|
183
|
|
|
} |
|
184
|
|
|
|
|
185
|
|
|
/** |
|
186
|
|
|
* @return string |
|
187
|
|
|
*/ |
|
188
|
1 |
|
public function getTargetWebspace() |
|
189
|
|
|
{ |
|
190
|
1 |
|
return $this->article->getTargetWebspace(); |
|
191
|
|
|
} |
|
192
|
|
|
|
|
193
|
|
|
/** |
|
194
|
|
|
* @return string |
|
195
|
|
|
*/ |
|
196
|
|
|
public function getMainWebspace() |
|
197
|
|
|
{ |
|
198
|
|
|
return $this->article->getMainWebspace(); |
|
199
|
|
|
} |
|
200
|
|
|
|
|
201
|
|
|
/** |
|
202
|
|
|
* @return null|string[] |
|
203
|
|
|
*/ |
|
204
|
|
|
public function getAdditionalWebspaces() |
|
205
|
|
|
{ |
|
206
|
|
|
return $this->article->getAdditionalWebspaces(); |
|
207
|
|
|
} |
|
208
|
|
|
|
|
209
|
|
|
/** |
|
210
|
|
|
* {@inheritdoc} |
|
211
|
|
|
*/ |
|
212
|
|
|
public function getResource() |
|
213
|
|
|
{ |
|
214
|
|
|
return $this->resource; |
|
215
|
|
|
} |
|
216
|
|
|
|
|
217
|
|
|
/** |
|
218
|
|
|
* {@inheritdoc} |
|
219
|
|
|
*/ |
|
220
|
|
|
public function getId() |
|
221
|
|
|
{ |
|
222
|
|
|
return $this->getUuid(); |
|
223
|
|
|
} |
|
224
|
|
|
|
|
225
|
|
|
|
|
226
|
|
|
/** |
|
227
|
|
|
* {@inheritDoc} |
|
228
|
|
|
*/ |
|
229
|
|
|
public function getAuthorId() |
|
230
|
|
|
{ |
|
231
|
|
|
return $this->article->getAuthorId(); |
|
232
|
|
|
} |
|
233
|
|
|
|
|
234
|
|
|
/** |
|
235
|
|
|
* {@inheritDoc} |
|
236
|
|
|
*/ |
|
237
|
|
|
public function getAuthorFullName() |
|
238
|
|
|
{ |
|
239
|
|
|
return $this->article->getAuthorFullName(); |
|
240
|
|
|
} |
|
241
|
|
|
} |
|
242
|
|
|
|