1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11:
12:
13: namespace DcGeneral\Data;
14:
15: 16: 17: 18: 19: 20: 21: 22:
23: class NoOpDataProvider implements DataProviderInterface
24: {
25: 26: 27: 28: 29:
30: protected $arrBaseConfig;
31:
32: 33: 34:
35: public function setBaseConfig(array $arrConfig)
36: {
37: $this->arrBaseConfig = $arrConfig;
38: }
39:
40: 41: 42:
43: public function getEmptyConfig()
44: {
45: return DefaultConfig::init();
46: }
47:
48: 49: 50:
51: public function getEmptyModel()
52: {
53: return new DefaultModel();
54: }
55:
56: 57: 58:
59: public function getEmptyCollection()
60: {
61: return new DefaultCollection();
62: }
63:
64: 65: 66:
67: public function fetch(ConfigInterface $objConfig)
68: {
69: return new DefaultModel();
70: }
71:
72: 73: 74:
75: public function fetchAll(ConfigInterface $objConfig)
76: {
77: return new DefaultCollection();
78: }
79:
80: 81: 82:
83: public function getFilterOptions(ConfigInterface $objConfig)
84: {
85: return new DefaultCollection();
86: }
87:
88: 89: 90:
91: public function getCount(ConfigInterface $objConfig)
92: {
93: return 0;
94: }
95:
96: 97: 98:
99: public function save(ModelInterface $objItem)
100: {
101: }
102:
103: 104: 105:
106: public function saveEach(CollectionInterface $objItems)
107: {
108: foreach ($objItems as $objItem)
109: {
110: $this->save($objItem);
111: }
112: }
113:
114: 115: 116:
117: public function delete($item)
118: {
119: }
120:
121: 122: 123:
124: public function saveVersion(ModelInterface $objModel, $strUsername)
125: {
126: }
127:
128: 129: 130:
131: public function getVersion($mixID, $mixVersion)
132: {
133: return null;
134: }
135:
136: 137: 138:
139: public function getVersions($mixID, $blnOnlyActive = false)
140: {
141: return null;
142: }
143:
144: 145: 146:
147: public function setVersionActive($mixID, $mixVersion)
148: {
149: }
150:
151: 152: 153:
154: public function getActiveVersion($mixID)
155: {
156: return null;
157: }
158:
159: 160: 161:
162: public function resetFallback($strField)
163: {
164: }
165:
166: 167: 168:
169: public function isUniqueValue($strField, $varNew, $intId = null)
170: {
171: return true;
172: }
173:
174: 175: 176:
177: public function fieldExists($strField)
178: {
179: return false;
180: }
181:
182: 183: 184:
185: public function sameModels($objModel1 , $objModel2)
186: {
187: $arrProperties1 = $objModel1->getPropertiesAsArray();
188: $arrProperties2 = $objModel2->getPropertiesAsArray();
189:
190: $arrKeys = array_merge(array_keys($arrProperties1), array_keys($arrProperties2));
191: $arrKeys = array_unique($arrKeys);
192: foreach ($arrKeys as $strKey)
193: {
194: if (!array_key_exists($strKey, $arrProperties1) ||
195: !array_key_exists($strKey, $arrProperties2) ||
196: $arrProperties1[$strKey] != $arrProperties2[$strKey]
197: )
198: {
199: return false;
200: }
201: }
202:
203: return true;
204: }
205: }
206: