1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* File containing the eZ\Publish\API\Repository\Values\Content\VersionInfo class. |
5
|
|
|
* |
6
|
|
|
* @copyright Copyright (C) eZ Systems AS. All rights reserved. |
7
|
|
|
* @license For full copyright and license information view LICENSE file distributed with this source code. |
8
|
|
|
*/ |
9
|
|
|
namespace eZ\Publish\API\Repository\Values\Content; |
10
|
|
|
|
11
|
|
|
use eZ\Publish\API\Repository\Values\ValueObject; |
12
|
|
|
use eZ\Publish\SPI\Repository\Values\MultiLanguageName; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* This class holds version information data. It also contains the corresponding {@link Content} to |
16
|
|
|
* which the version belongs to. |
17
|
|
|
* |
18
|
|
|
* @property-read \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo calls getContentInfo() |
19
|
|
|
* @property-read mixed $id the internal id of the version |
20
|
|
|
* @property-read int $versionNo the version number of this version (which only increments in scope of a single Content object) |
21
|
|
|
* @property-read \DateTime $modificationDate the last modified date of this version |
22
|
|
|
* @property-read \DateTime $creationDate the creation date of this version |
23
|
|
|
* @property-read mixed $creatorId the user id of the user which created this version |
24
|
|
|
* @property-read int $status the status of this version. One of VersionInfo::STATUS_DRAFT, VersionInfo::STATUS_PUBLISHED, VersionInfo::STATUS_ARCHIVED |
25
|
|
|
* @property-read string $initialLanguageCode the language code of the version. This value is used to flag a version as a translation to specific language |
26
|
|
|
* @property-read string[] $languageCodes a collection of all languages which exist in this version. |
27
|
|
|
*/ |
28
|
|
|
abstract class VersionInfo extends ValueObject implements MultiLanguageName |
29
|
|
|
{ |
30
|
|
|
const STATUS_DRAFT = 0; |
31
|
|
|
const STATUS_PUBLISHED = 1; |
32
|
|
|
const STATUS_ARCHIVED = 3; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Version ID. |
36
|
|
|
* |
37
|
|
|
* @var mixed |
38
|
|
|
*/ |
39
|
|
|
protected $id; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Version number. |
43
|
|
|
* |
44
|
|
|
* In contrast to {@link $id}, this is the version number, which only |
45
|
|
|
* increments in scope of a single Content object. |
46
|
|
|
* |
47
|
|
|
* @var int |
48
|
|
|
*/ |
49
|
|
|
protected $versionNo; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Content of the content this version belongs to. |
53
|
|
|
* |
54
|
|
|
* @return \eZ\Publish\API\Repository\Values\Content\ContentInfo |
55
|
|
|
*/ |
56
|
|
|
abstract public function getContentInfo(); |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* the last modified date of this version. |
60
|
|
|
* |
61
|
|
|
* @var \DateTime |
62
|
|
|
*/ |
63
|
|
|
protected $modificationDate; |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Creator user ID. |
67
|
|
|
* |
68
|
|
|
* Creator of the version, in the search API this is referred to as the modifier of the published content. |
69
|
|
|
* |
70
|
|
|
* @var mixed |
71
|
|
|
*/ |
72
|
|
|
protected $creatorId; |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @var \DateTime |
76
|
|
|
*/ |
77
|
|
|
protected $creationDate; |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* One of VersionInfo::STATUS_DRAFT, VersionInfo::STATUS_PUBLISHED, VersionInfo::STATUS_ARCHIVED. |
81
|
|
|
* |
82
|
|
|
* @var int Constant. |
83
|
|
|
*/ |
84
|
|
|
protected $status; |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* In 4.x this is the language code which is used for labeling a translation. |
88
|
|
|
* |
89
|
|
|
* @var string |
90
|
|
|
*/ |
91
|
|
|
protected $initialLanguageCode; |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* List of languages in this version. |
95
|
|
|
* |
96
|
|
|
* Reflects which languages fields exists in for this version. |
97
|
|
|
* |
98
|
|
|
* @var string[] |
99
|
|
|
*/ |
100
|
|
|
protected $languageCodes = array(); |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* Returns true if version is a draft. |
104
|
|
|
* |
105
|
|
|
* @return bool |
106
|
|
|
*/ |
107
|
|
|
public function isDraft() |
108
|
|
|
{ |
109
|
|
|
return $this->status === self::STATUS_DRAFT; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* Returns true if version is published. |
114
|
|
|
* |
115
|
|
|
* @return bool |
116
|
|
|
*/ |
117
|
|
|
public function isPublished() |
118
|
|
|
{ |
119
|
|
|
return $this->status === self::STATUS_PUBLISHED; |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* Returns true if version is archived. |
124
|
|
|
* |
125
|
|
|
* @return bool |
126
|
|
|
*/ |
127
|
|
|
public function isArchived() |
128
|
|
|
{ |
129
|
|
|
return $this->status === self::STATUS_ARCHIVED; |
130
|
|
|
} |
131
|
|
|
} |
132
|
|
|
|