NullMapper.php
1 <?php
2 /**
3  * wCMF - wemove Content Management Framework
4  * Copyright (C) 2005-2020 wemove digital solutions GmbH
5  *
6  * Licensed under the terms of the MIT License.
7  *
8  * See the LICENSE file distributed with this work for
9  * additional information.
10  */
12 
21 
22 /**
23  * NullMapper acts as there is no mapper.
24  *
25  * @author ingo herwig <ingo@wemove.com>
26  */
27 class NullMapper implements PersistenceMapper {
28 
29  /**
30  * @see PersistenceMapper::getType()
31  */
32  public function getType() {
33  return 'NULLType';
34  }
35 
36  /**
37  * @see PersistenceMapper::getTypeDisplayName()
38  */
39  public function getTypeDisplayName(Message $message) {
40  return $message->getText('NULLType');
41  }
42 
43  /**
44  * @see PersistenceMapper::getTypeDescription()
45  */
46  public function getTypeDescription(Message $message) {
47  return '';
48  }
49 
50  /**
51  * @see PersistenceMapper::getPkNames()
52  */
53  public function getPkNames() {
54  return [];
55  }
56 
57  /**
58  * @see PersistenceMapper::getRelations()
59  */
60  public function getRelations($hierarchyType='all') {
61  return [];
62  }
63 
64  /**
65  * @see PersistenceMapper::hasRelation()
66  */
67  public function hasRelation($roleName) {
68  return false;
69  }
70 
71  /**
72  * @see PersistenceMapper::getRelation()
73  */
74  public function getRelation($roleName) {
75  return null;
76  }
77 
78  /**
79  * @see PersistenceMapper::getRelationsByType()
80  */
81  public function getRelationsByType($type) {
82  return [];
83  }
84 
85  /**
86  * @see PersistenceMapper::getAttributes()
87  */
88  public function getAttributes(array $tags=[], $matchMode='all') {
89  return [];
90  }
91 
92  /**
93  * @see PersistenceMapper::hasAttribute()
94  */
95  public function hasAttribute($name) {
96  return false;
97  }
98 
99  /**
100  * @see PersistenceMapper::getAttribute()
101  */
102  public function getAttribute($name) {
103  return null;
104  }
105 
106  /**
107  * @see PersistenceMapper::getReferences()
108  */
109  public function getReferences() {
110  return [];
111  }
112 
113  /**
114  * @see PersistenceMapper::getAttributeDisplayName()
115  */
116  public function getAttributeDisplayName($name, Message $message) {
117  return $name;
118  }
119 
120  /**
121  * @see PersistenceMapper::getAttributeDescription()
122  */
123  public function getAttributeDescription($name, Message $message) {
124  return '';
125  }
126 
127  /**
128  * @see PersistenceMapper::getProperties()
129  */
130  public function getProperties() {
131  return [];
132  }
133 
134  /**
135  * @see PersistenceMapper::isSortable()
136  */
137  public function isSortable($roleName=null) {
138  return false;
139  }
140 
141  /**
142  * @see PersistenceMapper::getSortkey()
143  */
144  public function getSortkey($roleName=null) {
145  return [];
146  }
147 
148  /**
149  * @see PersistenceMapper::getDefaultOrder()
150  */
151  public function getDefaultOrder($roleName=null) {
152  return [];
153  }
154 
155  /**
156  * @see PersistenceMapper::load()
157  */
158  public function load(ObjectId $oid, $buildDepth=BuildDepth::SINGLE) {
159  return null;
160  }
161 
162  /**
163  * @see PersistenceMapper::create()
164  */
165  public function create($type, $buildDepth=BuildDepth::SINGLE) {
166  return new PersistentObject();
167  }
168 
169  /**
170  * @see PersistenceMapper::save()
171  */
172  public function save(PersistentObject $object) {}
173 
174  /**
175  * @see PersistenceMapper::delete()
176  */
177  public function delete(PersistentObject $object) {}
178 
179  /**
180  * @see PersistenceFacade::getOIDs()
181  */
182  public function getOIDs($type, $criteria=null, $orderby=null, PagingInfo $pagingInfo=null) {
183  return [];
184  }
185 
186  /**
187  * @see PersistenceFacade::loadObjects()
188  */
189  public function loadObjects($type, $buildDepth=BuildDepth::SINGLE, $criteria=null, $orderby=null,
190  PagingInfo $pagingInfo=null) {
191  return [];
192  }
193 
194  /**
195  * @see PersistenceMapper::loadRelation()
196  */
197  public function loadRelation(array $objects, $role, $buildDepth=BuildDepth::SINGLE, $criteria=null, $orderby=null,
198  PagingInfo $pagingInfo=null) {
199  return [];
200  }
201 
202  /**
203  * @see PersistenceMapper::executeOperation()
204  */
205  public function executeOperation(PersistenceOperation $operation) {
206  return 0;
207  }
208 
209  /**
210  * @see PersistenceMapper::beginTransaction()
211  */
212  public function beginTransaction() {}
213 
214  /**
215  * @see PersistenceMapper::commitTransaction()
216  */
217  public function commitTransaction() {}
218 
219  /**
220  * @see PersistenceMapper::rollbackTransaction()
221  */
222  public function rollbackTransaction() {}
223 
224  /**
225  * @see PersistenceMapper::getStatements()
226  */
227  public function getStatements() {
228  return [];
229  }
230 }
231 ?>
NullMapper acts as there is no mapper.
Definition: NullMapper.php:27
A PersistenceOperation instance holds data necessary to accomplish an operation on the persistent sto...
loadRelation(array $objects, $role, $buildDepth=BuildDepth::SINGLE, $criteria=null, $orderby=null, PagingInfo $pagingInfo=null)
Definition: NullMapper.php:197
getOIDs($type, $criteria=null, $orderby=null, PagingInfo $pagingInfo=null)
Definition: NullMapper.php:182
load(ObjectId $oid, $buildDepth=BuildDepth::SINGLE)
Definition: NullMapper.php:158
create($type, $buildDepth=BuildDepth::SINGLE)
Definition: NullMapper.php:165
PersistenceMapper defines the interface for all mapper classes.
getText($message, $parameters=null, $lang='')
Get a localized string.
ObjectId is the unique identifier of an object.
Definition: ObjectId.php:28
BuildDepth values are used to define the depth when loading object trees.
Definition: BuildDepth.php:19
getRelations($hierarchyType='all')
Definition: NullMapper.php:60
loadObjects($type, $buildDepth=BuildDepth::SINGLE, $criteria=null, $orderby=null, PagingInfo $pagingInfo=null)
Definition: NullMapper.php:189
PersistenceFacade defines the interface for PersistenceFacade implementations.
executeOperation(PersistenceOperation $operation)
Definition: NullMapper.php:205
getAttributeDescription($name, Message $message)
Definition: NullMapper.php:123
getTypeDisplayName(Message $message)
Definition: NullMapper.php:39
save(PersistentObject $object)
Definition: NullMapper.php:172
getTypeDescription(Message $message)
Definition: NullMapper.php:46
PagingInfo contains information about a paged list.
Definition: PagingInfo.php:18
PersistentObject defines the interface of all persistent objects.
getAttributes(array $tags=[], $matchMode='all')
Definition: NullMapper.php:88
getAttributeDisplayName($name, Message $message)
Definition: NullMapper.php:116
Message is used to get localized messages to be used in the user interface.
Definition: Message.php:23