| author | ymh <ymh.work@gmail.com> |
| Fri, 09 Dec 2011 06:43:49 +0100 | |
| changeset 62 | 10be6b9e55e7 |
| parent 58 | 87bf6ec8af90 |
| child 83 | e9f04298bdfa |
| permissions | -rwxr-xr-x |
| 2 | 1 |
<?php |
2 |
/* |
|
3 |
* This file is part of the WikiTagBundle package. |
|
4 |
* |
|
5 |
* (c) IRI <http://www.iri.centrepompidou.fr/> |
|
6 |
* |
|
7 |
* For the full copyright and license information, please view the LICENSE |
|
8 |
* file that was distributed with this source code. |
|
9 |
*/ |
|
10 |
namespace IRI\Bundle\WikiTagBundle\Model; |
|
11 |
||
|
14
673b2766024e
Update ORM configuration to allow JOIN between Tag and DocumentTag. TagList template has now the number of documents by tag.
cavaliet
parents:
11
diff
changeset
|
12 |
use Doctrine\Common\Collections\ArrayCollection; |
|
673b2766024e
Update ORM configuration to allow JOIN between Tag and DocumentTag. TagList template has now the number of documents by tag.
cavaliet
parents:
11
diff
changeset
|
13 |
|
|
673b2766024e
Update ORM configuration to allow JOIN between Tag and DocumentTag. TagList template has now the number of documents by tag.
cavaliet
parents:
11
diff
changeset
|
14 |
use IRI\Bundle\WikiTagBundle\Utils\WikiTagUtils; |
| 8 | 15 |
|
16 |
abstract class Tag implements TagInterface { |
|
| 2 | 17 |
|
| 58 | 18 |
public static $TAG_URL_STATUS_DICT = array('null_result'=>0,'redirection'=>1,'homonyme'=>2,'match'=>3, 'unsemantized'=>4); |
| 2 | 19 |
|
20 |
/** |
|
21 |
* @var integer $id |
|
22 |
*/ |
|
23 |
protected $id; |
|
24 |
||
25 |
/** |
|
26 |
* @var string $label |
|
27 |
*/ |
|
28 |
protected $label; |
|
29 |
||
30 |
/** |
|
31 |
* @var string $normalizedLabel |
|
32 |
*/ |
|
33 |
protected $normalizedLabel; |
|
34 |
||
35 |
/** |
|
36 |
* @var string $originalLabel |
|
37 |
*/ |
|
38 |
protected $originalLabel; |
|
|
42
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
39 |
|
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
40 |
/** |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
41 |
* @var $alternativeLabel |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
42 |
*/ |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
43 |
protected $alternativeLabel; |
| 2 | 44 |
|
45 |
/** |
|
46 |
* @var string $alias |
|
47 |
*/ |
|
48 |
protected $alias; |
|
49 |
||
50 |
/** |
|
51 |
* @var string $wikipediaUrl |
|
52 |
*/ |
|
53 |
protected $wikipediaUrl; |
|
54 |
||
55 |
/** |
|
|
42
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
56 |
* @var string $alternativeWikipediaUrl |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
57 |
*/ |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
58 |
protected $alternativeWikipediaUrl; |
|
62
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
59 |
|
|
42
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
60 |
/** |
| 2 | 61 |
* @var bigint $wikipediaPageId |
62 |
*/ |
|
63 |
protected $wikipediaPageId; |
|
64 |
||
|
42
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
65 |
/** |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
66 |
* @var bigint $alternativeWikipediaPageId |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
67 |
*/ |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
68 |
protected $alternativeWikipediaPageId; |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
69 |
|
| 2 | 70 |
/** |
71 |
* @var smallint $urlStatus |
|
72 |
*/ |
|
73 |
protected $urlStatus; |
|
74 |
||
75 |
/** |
|
76 |
* @var string $dbpediaUri |
|
77 |
*/ |
|
78 |
protected $dbpediaUri; |
|
79 |
||
80 |
/** |
|
81 |
* @var integer $popularity |
|
82 |
*/ |
|
83 |
protected $popularity = 0; |
|
84 |
||
85 |
/** |
|
86 |
* @var object $category |
|
87 |
*/ |
|
88 |
protected $category; |
|
89 |
||
|
14
673b2766024e
Update ORM configuration to allow JOIN between Tag and DocumentTag. TagList template has now the number of documents by tag.
cavaliet
parents:
11
diff
changeset
|
90 |
/** |
|
673b2766024e
Update ORM configuration to allow JOIN between Tag and DocumentTag. TagList template has now the number of documents by tag.
cavaliet
parents:
11
diff
changeset
|
91 |
* @var ArrayCollection $documents |
|
673b2766024e
Update ORM configuration to allow JOIN between Tag and DocumentTag. TagList template has now the number of documents by tag.
cavaliet
parents:
11
diff
changeset
|
92 |
*/ |
|
673b2766024e
Update ORM configuration to allow JOIN between Tag and DocumentTag. TagList template has now the number of documents by tag.
cavaliet
parents:
11
diff
changeset
|
93 |
protected $documents; |
|
62
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
94 |
|
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
95 |
/** |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
96 |
* @var DateTime |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
97 |
*/ |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
98 |
protected $createdAt; |
|
14
673b2766024e
Update ORM configuration to allow JOIN between Tag and DocumentTag. TagList template has now the number of documents by tag.
cavaliet
parents:
11
diff
changeset
|
99 |
|
| 2 | 100 |
|
101 |
/** |
|
|
62
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
102 |
* |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
103 |
* construct the class |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
104 |
*/ |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
105 |
function __construct() |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
106 |
{ |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
107 |
$this->createdAt = new \DateTime("now", new \DateTimeZone('UTC')); |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
108 |
} |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
109 |
|
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
110 |
/** |
| 2 | 111 |
* Get id |
112 |
* |
|
113 |
* @return integer |
|
114 |
*/ |
|
115 |
public function getId() |
|
116 |
{ |
|
117 |
return $this->id; |
|
118 |
} |
|
119 |
||
120 |
/** |
|
121 |
* Set label |
|
122 |
* |
|
123 |
* @param string $label |
|
124 |
*/ |
|
125 |
public function setLabel($label) |
|
126 |
{ |
|
127 |
$this->label = $label; |
|
| 8 | 128 |
$this->normalizedLabel = WikiTagUtils::normalizeTag($label); |
| 2 | 129 |
} |
130 |
||
131 |
/** |
|
132 |
* Get label |
|
133 |
* |
|
134 |
* @return string |
|
135 |
*/ |
|
136 |
public function getLabel() |
|
137 |
{ |
|
138 |
return $this->label; |
|
139 |
} |
|
140 |
||
141 |
/** |
|
142 |
* Set normalizedLabel |
|
143 |
* |
|
144 |
* @param string $normalizedLabel |
|
145 |
*/ |
|
146 |
public function setNormalizedLabel($normalizedLabel) |
|
147 |
{ |
|
148 |
$this->normalizedLabel = $normalizedLabel; |
|
149 |
} |
|
150 |
||
151 |
/** |
|
152 |
* Get normalizedLabel |
|
153 |
* |
|
154 |
* @return string |
|
155 |
*/ |
|
156 |
public function getNormalizedLabel() |
|
157 |
{ |
|
158 |
return $this->normalizedLabel; |
|
159 |
} |
|
160 |
||
161 |
/** |
|
162 |
* Set originalLabel |
|
163 |
* |
|
164 |
* @param string $originalLabel |
|
165 |
*/ |
|
166 |
public function setOriginalLabel($originalLabel) |
|
167 |
{ |
|
168 |
$this->originalLabel = $originalLabel; |
|
169 |
} |
|
170 |
||
171 |
/** |
|
172 |
* Get originalLabel |
|
173 |
* |
|
174 |
* @return string |
|
175 |
*/ |
|
176 |
public function getOriginalLabel() |
|
177 |
{ |
|
178 |
return $this->originalLabel; |
|
179 |
} |
|
180 |
||
181 |
/** |
|
|
42
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
182 |
* Set alternativeLabel |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
183 |
* |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
184 |
* @param string $alternativeLabel |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
185 |
*/ |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
186 |
public function setAlternativeLabel($alternativeLabel) |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
187 |
{ |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
188 |
$this->alternativeLabel = $alternativeLabel; |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
189 |
} |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
190 |
|
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
191 |
/** |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
192 |
* Get alternativeLabel |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
193 |
* |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
194 |
* @return string |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
195 |
*/ |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
196 |
public function getAlternativeLabel() |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
197 |
{ |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
198 |
return $this->alternativeLabel; |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
199 |
} |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
200 |
|
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
201 |
|
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
202 |
|
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
203 |
/** |
| 2 | 204 |
* Set alias |
205 |
* |
|
206 |
* @param string $alias |
|
207 |
*/ |
|
208 |
public function setAlias($alias) |
|
209 |
{ |
|
210 |
$this->alias = $alias; |
|
211 |
} |
|
212 |
||
213 |
/** |
|
214 |
* Get alias |
|
215 |
* |
|
216 |
* @return string |
|
217 |
*/ |
|
218 |
public function getAlias() |
|
219 |
{ |
|
220 |
return $this->alias; |
|
221 |
} |
|
222 |
||
223 |
/** |
|
224 |
* Set wikipediaUrl |
|
225 |
* |
|
226 |
* @param string $wikipediaUrl |
|
227 |
*/ |
|
228 |
public function setWikipediaUrl($wikipediaUrl) |
|
229 |
{ |
|
230 |
$this->wikipediaUrl = $wikipediaUrl; |
|
231 |
} |
|
232 |
||
233 |
/** |
|
234 |
* Get wikipediaUrl |
|
235 |
* |
|
236 |
* @return string |
|
237 |
*/ |
|
238 |
public function getWikipediaUrl() |
|
239 |
{ |
|
240 |
return $this->wikipediaUrl; |
|
241 |
} |
|
242 |
||
|
42
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
243 |
|
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
244 |
/** |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
245 |
* Set alternativeWikipediaUrl |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
246 |
* |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
247 |
* @param string $alternativeWikipediaUrl |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
248 |
*/ |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
249 |
public function setAlternativeWikipediaUrl($alternativeWikipediaUrl) |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
250 |
{ |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
251 |
$this->alternativeWikipediaUrl = $alternativeWikipediaUrl; |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
252 |
} |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
253 |
|
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
254 |
/** |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
255 |
* Get alternativeWikipediaUrl |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
256 |
* |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
257 |
* @return string |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
258 |
*/ |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
259 |
public function getAlternativeWikipediaUrl() |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
260 |
{ |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
261 |
return $this->alternativeWikipediaUrl; |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
262 |
} |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
263 |
|
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
264 |
|
| 2 | 265 |
/** |
266 |
* Set wikipediaPageId |
|
267 |
* |
|
268 |
* @param bigint $wikipediaPageId |
|
269 |
*/ |
|
270 |
public function setWikipediaPageId($wikipediaPageId) |
|
271 |
{ |
|
272 |
$this->wikipediaPageId = $wikipediaPageId; |
|
273 |
} |
|
274 |
||
275 |
/** |
|
276 |
* Get wikipediaPageId |
|
277 |
* |
|
278 |
* @return bigint |
|
279 |
*/ |
|
280 |
public function getWikipediaPageId() |
|
281 |
{ |
|
282 |
return $this->wikipediaPageId; |
|
283 |
} |
|
284 |
||
285 |
/** |
|
|
42
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
286 |
* Set alternativeWikipediaPageId |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
287 |
* |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
288 |
* @param bigint $alternativeWikipediaPageId |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
289 |
*/ |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
290 |
function setAlternativeWikipediaPageId($alternativeWikipediaPageId) |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
291 |
{ |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
292 |
$this->alternativeWikipediaPageId = $alternativeWikipediaPageId; |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
293 |
} |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
294 |
|
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
295 |
/** |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
296 |
* Get alternativeWikipediaPageId |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
297 |
* |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
298 |
* @return bigint |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
299 |
*/ |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
300 |
function getAlternativeWikipediaPageId() |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
301 |
{ |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
302 |
return $this->alternativeWikipediaPageId; |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
303 |
} |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
304 |
|
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
305 |
|
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
306 |
/** |
| 2 | 307 |
* Set urlStatus |
308 |
* |
|
309 |
* @param smallint $urlStatus |
|
310 |
*/ |
|
311 |
public function setUrlStatus($urlStatus) |
|
312 |
{ |
|
313 |
$this->urlStatus = $urlStatus; |
|
314 |
} |
|
315 |
||
316 |
/** |
|
317 |
* Get urlStatus |
|
318 |
* |
|
319 |
* @return smallint |
|
320 |
*/ |
|
321 |
public function getUrlStatus() |
|
322 |
{ |
|
323 |
return $this->urlStatus; |
|
324 |
} |
|
|
5
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
325 |
|
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
326 |
/** |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
327 |
* Get UrlStatusText |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
328 |
* |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
329 |
* @return string |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
330 |
*/ |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
331 |
public function getUrlStatusText() |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
332 |
{ |
| 58 | 333 |
if(is_null($this->getUrlStatus())) |
334 |
{ |
|
335 |
return null; |
|
336 |
} |
|
|
5
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
337 |
switch ($this->getUrlStatus()) { |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
338 |
case 0: |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
339 |
return "null_result"; |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
340 |
case 1: |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
341 |
return "redirection"; |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
342 |
case 2: |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
343 |
return "homonyme"; |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
344 |
case 3: |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
345 |
return "match"; |
| 58 | 346 |
case 4: |
347 |
return "unsemantized"; |
|
348 |
default: |
|
349 |
return ""; |
|
|
5
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
350 |
} |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
351 |
} |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
352 |
|
| 2 | 353 |
|
354 |
/** |
|
355 |
* Set dbpediaUri |
|
356 |
* |
|
357 |
* @param string $dbpediaUri |
|
358 |
*/ |
|
359 |
public function setDbpediaUri($dbpediaUri) |
|
360 |
{ |
|
361 |
$this->dbpediaUri = $dbpediaUri; |
|
362 |
} |
|
363 |
||
364 |
/** |
|
365 |
* Get dbpediaUri |
|
366 |
* |
|
367 |
* @return string |
|
368 |
*/ |
|
369 |
public function getDbpediaUri() |
|
370 |
{ |
|
371 |
return $this->dbpediaUri; |
|
372 |
} |
|
373 |
||
374 |
/** |
|
375 |
* Set popularity |
|
376 |
* |
|
377 |
* @param integer $popularity |
|
378 |
*/ |
|
379 |
public function setPopularity($popularity) |
|
380 |
{ |
|
381 |
$this->popularity = $popularity; |
|
382 |
} |
|
383 |
||
384 |
/** |
|
385 |
* Get popularity |
|
386 |
* |
|
387 |
* @return integer |
|
388 |
*/ |
|
389 |
public function getPopularity() |
|
390 |
{ |
|
391 |
return $this->popularity; |
|
392 |
} |
|
393 |
||
|
5
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
394 |
/** |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
395 |
* Set category |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
396 |
* |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
397 |
* @param object $category |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
398 |
*/ |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
399 |
public function setCategory($category) |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
400 |
{ |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
401 |
$this->category = $category; |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
402 |
} |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
403 |
|
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
404 |
/** |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
405 |
* Get category |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
406 |
* |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
407 |
* @return object |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
408 |
*/ |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
409 |
function getCategory() |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
410 |
{ |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
411 |
return $this->category; |
|
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
412 |
} |
|
62
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
413 |
|
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
414 |
/** |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
415 |
* (non-PHPdoc) |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
416 |
* @see IRI\Bundle\WikiTagBundle\Model.TagInterface::getCreatedAt() |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
417 |
*/ |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
418 |
function getCreatedAt() |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
419 |
{ |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
420 |
return $this->createdAt; |
|
10be6b9e55e7
add creation timestamp on document tag and document tag
ymh <ymh.work@gmail.com>
parents:
58
diff
changeset
|
421 |
} |
|
14
673b2766024e
Update ORM configuration to allow JOIN between Tag and DocumentTag. TagList template has now the number of documents by tag.
cavaliet
parents:
11
diff
changeset
|
422 |
|
|
673b2766024e
Update ORM configuration to allow JOIN between Tag and DocumentTag. TagList template has now the number of documents by tag.
cavaliet
parents:
11
diff
changeset
|
423 |
/** |
|
673b2766024e
Update ORM configuration to allow JOIN between Tag and DocumentTag. TagList template has now the number of documents by tag.
cavaliet
parents:
11
diff
changeset
|
424 |
* Get Documents |
|
673b2766024e
Update ORM configuration to allow JOIN between Tag and DocumentTag. TagList template has now the number of documents by tag.
cavaliet
parents:
11
diff
changeset
|
425 |
* |
|
673b2766024e
Update ORM configuration to allow JOIN between Tag and DocumentTag. TagList template has now the number of documents by tag.
cavaliet
parents:
11
diff
changeset
|
426 |
* @return ArrayCollection |
|
673b2766024e
Update ORM configuration to allow JOIN between Tag and DocumentTag. TagList template has now the number of documents by tag.
cavaliet
parents:
11
diff
changeset
|
427 |
*/ |
|
673b2766024e
Update ORM configuration to allow JOIN between Tag and DocumentTag. TagList template has now the number of documents by tag.
cavaliet
parents:
11
diff
changeset
|
428 |
public function getDocuments() |
|
673b2766024e
Update ORM configuration to allow JOIN between Tag and DocumentTag. TagList template has now the number of documents by tag.
cavaliet
parents:
11
diff
changeset
|
429 |
{ |
|
673b2766024e
Update ORM configuration to allow JOIN between Tag and DocumentTag. TagList template has now the number of documents by tag.
cavaliet
parents:
11
diff
changeset
|
430 |
return $this->documents; |
|
673b2766024e
Update ORM configuration to allow JOIN between Tag and DocumentTag. TagList template has now the number of documents by tag.
cavaliet
parents:
11
diff
changeset
|
431 |
} |
|
5
45378793512a
Correct tag insert + external id on doc
ymh <ymh.work@gmail.com>
parents:
2
diff
changeset
|
432 |
|
|
11
5f038a505cd7
Debug Category on tag list and document. Finish pagination for tag list.
cavaliet
parents:
8
diff
changeset
|
433 |
/** |
|
5f038a505cd7
Debug Category on tag list and document. Finish pagination for tag list.
cavaliet
parents:
8
diff
changeset
|
434 |
* Set category to Null |
|
5f038a505cd7
Debug Category on tag list and document. Finish pagination for tag list.
cavaliet
parents:
8
diff
changeset
|
435 |
* |
|
5f038a505cd7
Debug Category on tag list and document. Finish pagination for tag list.
cavaliet
parents:
8
diff
changeset
|
436 |
*/ |
|
5f038a505cd7
Debug Category on tag list and document. Finish pagination for tag list.
cavaliet
parents:
8
diff
changeset
|
437 |
function nullCategory() |
|
5f038a505cd7
Debug Category on tag list and document. Finish pagination for tag list.
cavaliet
parents:
8
diff
changeset
|
438 |
{ |
|
5f038a505cd7
Debug Category on tag list and document. Finish pagination for tag list.
cavaliet
parents:
8
diff
changeset
|
439 |
return $this->setCategory(NULL); |
|
5f038a505cd7
Debug Category on tag list and document. Finish pagination for tag list.
cavaliet
parents:
8
diff
changeset
|
440 |
} |
|
5f038a505cd7
Debug Category on tag list and document. Finish pagination for tag list.
cavaliet
parents:
8
diff
changeset
|
441 |
|
|
42
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
442 |
|
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
443 |
/** |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
444 |
* (non-PHPdoc) |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
445 |
* @see IRI\Bundle\WikiTagBundle\Model.TagInterface::setWikipediaInfo() |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
446 |
*/ |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
447 |
function setWikipediaInfo($wikipedia_info) |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
448 |
{ |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
449 |
$new_label = $wikipedia_info['new_label']; |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
450 |
$status = $wikipedia_info['status']; |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
451 |
$url = $wikipedia_info['wikipedia_url']; |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
452 |
$pageid = $wikipedia_info['pageid']; |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
453 |
$dbpedia_uri = $wikipedia_info["dbpedia_uri"]; |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
454 |
$wikipedia_revision_id = $wikipedia_info['revision_id']; |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
455 |
$alternative_label = array_key_exists('alternative_label', $wikipedia_info) ? $wikipedia_info['alternative_label'] : null; |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
456 |
$alternative_url = array_key_exists('wikipedia_alternative_url', $wikipedia_info) ? $wikipedia_info['wikipedia_alternative_url'] : null; |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
457 |
$alternative_pageid = array_key_exists('alternative_pageid', $wikipedia_info) ? $wikipedia_info['alternative_pageid'] : null; |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
458 |
|
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
459 |
# We save the datas |
| 43 | 460 |
if(! is_null($new_label)) |
|
42
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
461 |
{ |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
462 |
$this->setLabel($new_label); |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
463 |
} |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
464 |
|
| 43 | 465 |
if(! is_null($status)) |
|
42
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
466 |
{ |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
467 |
$this->setUrlStatus($status); |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
468 |
} |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
469 |
|
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
470 |
$this->setWikipediaUrl($url); |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
471 |
$this->setWikipediaPageId($pageid); |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
472 |
$this->setDbpediaUri($dbpedia_uri); |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
473 |
$this->setAlternativeLabel($alternative_label); |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
474 |
$this->setAlternativeWikipediaUrl($alternative_url); |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
475 |
$this->setAlternativeWikipediaPageId($alternative_pageid); |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
476 |
|
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
477 |
} |
|
0e57c730bb18
Documentation and add alternative wp url and label + migrations
ymh <ymh.work@gmail.com>
parents:
14
diff
changeset
|
478 |
|
| 2 | 479 |
|
480 |
} |