1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* ObjectStateService 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\Core\Repository\SiteAccessAware; |
10
|
|
|
|
11
|
|
|
use eZ\Publish\API\Repository\ObjectStateService as ObjectStateServiceInterface; |
12
|
|
|
use eZ\Publish\API\Repository\Values\ObjectState\ObjectStateCreateStruct; |
13
|
|
|
use eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroupCreateStruct; |
14
|
|
|
use eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroupUpdateStruct; |
15
|
|
|
use eZ\Publish\API\Repository\Values\ObjectState\ObjectStateUpdateStruct; |
16
|
|
|
use eZ\Publish\API\Repository\Values\ObjectState\ObjectState; |
17
|
|
|
use eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup; |
18
|
|
|
use eZ\Publish\API\Repository\Values\Content\ContentInfo; |
19
|
|
|
use eZ\Publish\Core\Repository\SiteAccessAware\Language\LanguageResolver; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* SiteAccess aware implementation of ObjectStateService injecting languages where needed. |
23
|
|
|
*/ |
24
|
|
|
class ObjectStateService implements ObjectStateServiceInterface |
25
|
|
|
{ |
26
|
|
|
/** @var \eZ\Publish\API\Repository\ObjectStateService */ |
27
|
|
|
protected $service; |
28
|
|
|
|
29
|
|
|
/** @var \eZ\Publish\Core\Repository\SiteAccessAware\Language\LanguageResolver */ |
30
|
|
|
protected $languageResolver; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Construct service object from aggregated service and LanguageResolver. |
34
|
|
|
* |
35
|
|
|
* @param \eZ\Publish\API\Repository\ObjectStateService $service |
36
|
|
|
* @param \eZ\Publish\Core\Repository\SiteAccessAware\Language\LanguageResolver $languageResolver |
37
|
|
|
*/ |
38
|
|
|
public function __construct( |
39
|
|
|
ObjectStateServiceInterface $service, |
40
|
|
|
LanguageResolver $languageResolver |
41
|
|
|
) { |
42
|
|
|
$this->service = $service; |
43
|
|
|
$this->languageResolver = $languageResolver; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
public function createObjectStateGroup(ObjectStateGroupCreateStruct $objectStateGroupCreateStruct) |
47
|
|
|
{ |
48
|
|
|
return $this->service->createObjectStateGroup($objectStateGroupCreateStruct); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function loadObjectStateGroup($objectStateGroupId, array $prioritizedLanguages = null) |
52
|
|
|
{ |
53
|
|
|
$prioritizedLanguages = $this->languageResolver->getPrioritizedLanguages($prioritizedLanguages); |
54
|
|
|
|
55
|
|
|
return $this->service->loadObjectStateGroup($objectStateGroupId, $prioritizedLanguages); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
public function loadObjectStateGroups($offset = 0, $limit = -1, array $prioritizedLanguages = null) |
59
|
|
|
{ |
60
|
|
|
$prioritizedLanguages = $this->languageResolver->getPrioritizedLanguages($prioritizedLanguages); |
61
|
|
|
|
62
|
|
|
return $this->service->loadObjectStateGroups($offset, $limit, $prioritizedLanguages); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
public function loadObjectStates(ObjectStateGroup $objectStateGroup, array $prioritizedLanguages = null) |
66
|
|
|
{ |
67
|
|
|
$prioritizedLanguages = $this->languageResolver->getPrioritizedLanguages($prioritizedLanguages); |
68
|
|
|
|
69
|
|
|
return $this->service->loadObjectStates($objectStateGroup, $prioritizedLanguages); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
public function updateObjectStateGroup(ObjectStateGroup $objectStateGroup, ObjectStateGroupUpdateStruct $objectStateGroupUpdateStruct) |
73
|
|
|
{ |
74
|
|
|
return $this->service->updateObjectStateGroup($objectStateGroup, $objectStateGroupUpdateStruct); |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
public function deleteObjectStateGroup(ObjectStateGroup $objectStateGroup) |
78
|
|
|
{ |
79
|
|
|
return $this->service->deleteObjectStateGroup($objectStateGroup); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
public function createObjectState(ObjectStateGroup $objectStateGroup, ObjectStateCreateStruct $objectStateCreateStruct) |
83
|
|
|
{ |
84
|
|
|
return $this->service->createObjectState($objectStateGroup, $objectStateCreateStruct); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
public function loadObjectState($stateId, array $prioritizedLanguages = null) |
88
|
|
|
{ |
89
|
|
|
$prioritizedLanguages = $this->languageResolver->getPrioritizedLanguages($prioritizedLanguages); |
90
|
|
|
|
91
|
|
|
return $this->service->loadObjectState($stateId, $prioritizedLanguages); |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
public function updateObjectState(ObjectState $objectState, ObjectStateUpdateStruct $objectStateUpdateStruct) |
95
|
|
|
{ |
96
|
|
|
return $this->service->updateObjectState($objectState, $objectStateUpdateStruct); |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
public function setPriorityOfObjectState(ObjectState $objectState, $priority) |
100
|
|
|
{ |
101
|
|
|
return $this->service->setPriorityOfObjectState($objectState, $priority); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
public function deleteObjectState(ObjectState $objectState) |
105
|
|
|
{ |
106
|
|
|
return $this->service->deleteObjectState($objectState); |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
public function setContentState(ContentInfo $contentInfo, ObjectStateGroup $objectStateGroup, ObjectState $objectState) |
110
|
|
|
{ |
111
|
|
|
return $this->service->setContentState($contentInfo, $objectStateGroup, $objectState); |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
public function getContentState(ContentInfo $contentInfo, ObjectStateGroup $objectStateGroup) |
115
|
|
|
{ |
116
|
|
|
return $this->service->getContentState($contentInfo, $objectStateGroup); |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
public function getContentCount(ObjectState $objectState) |
120
|
|
|
{ |
121
|
|
|
return $this->service->getContentCount($objectState); |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
public function newObjectStateGroupCreateStruct($identifier) |
125
|
|
|
{ |
126
|
|
|
return $this->service->newObjectStateGroupCreateStruct($identifier); |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
public function newObjectStateGroupUpdateStruct() |
130
|
|
|
{ |
131
|
|
|
return $this->service->newObjectStateGroupUpdateStruct(); |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
public function newObjectStateCreateStruct($identifier) |
135
|
|
|
{ |
136
|
|
|
return $this->service->newObjectStateCreateStruct($identifier); |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
public function newObjectStateUpdateStruct() |
140
|
|
|
{ |
141
|
|
|
return $this->service->newObjectStateUpdateStruct(); |
142
|
|
|
} |
143
|
|
|
} |
144
|
|
|
|