forked from ezsystems/ezpublish-api
/
ContentInfo.php
166 lines (146 loc) · 4.49 KB
/
ContentInfo.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<?php
/**
* File containing the eZ\Publish\API\Repository\Values\Content\ContentInfo class.
*
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
namespace eZ\Publish\API\Repository\Values\Content;
use eZ\Publish\API\Repository\Values\ValueObject;
/**
* This class provides all version independent information of the Content object.
*
* @property-read mixed $id The unique id of the Content object
* @property-read mixed $contentTypeId The unique id of the Content Type object the Content object is an instance of
* @property-read string $name the computed name (via name schema) in the main language of the Content object
* @property-read mixed $sectionId the section to which the Content object is assigned
* @property-read int $currentVersionNo Current Version number is the version number of the published version or the version number of a newly created draft (which is 1).
* @property-read bool $published true if there exists a published version false otherwise
* @property-read mixed $ownerId the user id of the owner of the Content object
* @property-read \DateTime $modificationDate Content object modification date
* @property-read \DateTime $publishedDate date of the first publish
* @property-read bool $alwaysAvailable Indicates if the Content object is shown in the mainlanguage if its not present in an other requested language
* @property-read string $remoteId a global unique id of the Content object
* @property-read string $mainLanguageCode The main language code of the Content object. If the available flag is set to true the Content is shown in this language if the requested language does not exist.
* @property-read mixed $mainLocationId Identifier of the main location.
* @property-read int $status status of the Content object
*/
class ContentInfo extends ValueObject
{
const STATUS_DRAFT = 0;
const STATUS_PUBLISHED = 1;
const STATUS_TRASHED = 2;
/**
* The unique id of the Content object.
*
* @var mixed
*/
protected $id;
/**
* The Content Type id of the Content object.
*
* @var mixed
*/
protected $contentTypeId;
/**
* The computed name (via name schema) in the main language of the Content object.
*
* For names in other languages then main see {@see \eZ\Publish\API\Repository\Values\Content\VersionInfo}
*
* @var string
*/
protected $name;
/**
* The section to which the Content object is assigned.
*
* @var mixed
*/
protected $sectionId;
/**
* Current Version number is the version number of the published version or the version number of
* a newly created draft (which is 1).
*
* @var int
*/
protected $currentVersionNo;
/**
* True if there exists a published version, false otherwise.
*
* @var bool Constant.
*/
protected $published;
/**
* The owner of the Content object.
*
* @var mixed
*/
protected $ownerId;
/**
* Content modification date.
*
* @var \DateTime
*/
protected $modificationDate;
/**
* Content publication date.
*
* @var \DateTime
*/
protected $publishedDate;
/**
* Indicates if the Content object is shown in the mainlanguage if its not present in an other requested language.
*
* @var bool
*/
protected $alwaysAvailable;
/**
* Remote identifier used as a custom identifier for the object.
*
* @var string
*/
protected $remoteId;
/**
* The main language code of the Content object.
*
* @var string
*/
protected $mainLanguageCode;
/**
* Identifier of the main location.
*
* If the Content object has multiple locations,
* $mainLocationId will point to the main one.
*
* @var mixed
*/
protected $mainLocationId;
/**
* Status of the content.
*
* Replaces deprecated API\ContentInfo::$published.
*
* @var int
*/
protected $status;
/**
* @return bool
*/
public function isDraft()
{
return $this->status === self::STATUS_DRAFT;
}
/**
* @return bool
*/
public function isPublished()
{
return $this->status === self::STATUS_PUBLISHED;
}
/**
* @return bool
*/
public function isTrashed()
{
return $this->status === self::STATUS_TRASHED;
}
}