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