1: <?php
2: /**
3: * PHP version 5
4: * @package generalDriver
5: * @author Christian Schiffler <c.schiffler@cyberspectrum.de>
6: * @author Stefan Heimes <stefan_heimes@hotmail.com>
7: * @author Tristan Lins <tristan.lins@bit3.de>
8: * @copyright The MetaModels team.
9: * @license LGPL.
10: * @filesource
11: */
12:
13: namespace DcGeneral\Data;
14:
15: /**
16: * Interface ConfigInterface.
17: *
18: * This interface describes the configuration objects to use when retrieving models and collections from a data
19: * provider.
20: *
21: * @package DcGeneral\Data
22: */
23: interface ConfigInterface
24: {
25: /**
26: * Static constructor.
27: *
28: * @todo: do we want to keep this behaviour? Third party will not know the correct class anyway.
29: *
30: * @return mixed
31: */
32: public static function init();
33:
34: /**
35: * Get specific id.
36: *
37: * @return mixed
38: */
39: public function getId();
40:
41: /**
42: * Set a specific id for an element to be retrieved.
43: *
44: * @param mixed $mixId The id of the element to be retrieved.
45: *
46: * @return ConfigInterface
47: */
48: public function setId($mixId);
49:
50: /**
51: * Get list of specific ids to be retrieved.
52: *
53: * @return array
54: */
55: public function getIds();
56:
57: /**
58: * Set list of specific ids to be retrieved.
59: *
60: * @param array $arrIds The list of ids to be retrieved.
61: *
62: * @return ConfigInterface
63: */
64: public function setIds($arrIds);
65:
66: /**
67: * Return flag if only ids should be returned.
68: *
69: * @return bool
70: */
71: public function getIdOnly();
72:
73: /**
74: * Set flag for return id only.
75: *
76: * @param bool $blnIdOnly Boolean flag to determine that only Ids shall be returned when calling fetchAll().
77: *
78: * @return ConfigInterface
79: */
80: public function setIdOnly($blnIdOnly);
81:
82: /**
83: * Get the offset to start with.
84: *
85: * This is the offset to use for pagination.
86: *
87: * @return int
88: */
89: public function getStart();
90:
91: /**
92: * Set the offset to start with.
93: *
94: * This is the offset to use for pagination.
95: *
96: * @param int $intStart Number of first element to return.
97: *
98: * @return ConfigInterface
99: */
100: public function setStart($intStart);
101:
102: /**
103: * Get the limit for results.
104: *
105: * This is the amount of items to return for pagination.
106: *
107: * @return int
108: */
109: public function getAmount();
110:
111: /**
112: * Set the limit for results.
113: *
114: * This is the amount of items to return for pagination.
115: *
116: * @param int $intAmount The amount to use.
117: *
118: * @return ConfigInterface
119: */
120: public function setAmount($intAmount);
121:
122: /**
123: * Get the list with filter options.
124: *
125: * @return array
126: */
127: public function getFilter();
128:
129: /**
130: * Set the list with filter options.
131: *
132: * @param array $arrFilter The array containing the filter values.
133: *
134: * @return ConfigInterface
135: */
136: public function setFilter($arrFilter);
137:
138: /**
139: * Get the list of all defined sortings.
140: *
141: * The returning array will be of 'property name' => 'ASC|DESC' nature.
142: *
143: * @return array
144: */
145: public function getSorting();
146:
147: /**
148: * Set the list of all defined sortings.
149: *
150: * The array must be of 'property name' => 'ASC|DESC' nature.
151: *
152: * @param array $arrSorting The sorting array to use.
153: *
154: * @return array
155: */
156: public function setSorting($arrSorting);
157:
158: /**
159: * Get the list of fields to be retrieved.
160: *
161: * @return array
162: */
163: public function getFields();
164:
165: /**
166: * Set the list of fields to be retrieved.
167: *
168: * @param array $arrFields Array of property names.
169: *
170: * @return ConfigInterface
171: */
172: public function setFields($arrFields);
173:
174: // TODO: make a property bag out of this.
175: /**
176: * Get the additional information.
177: *
178: * @param string $strKey The name of the information to retrieve.
179: *
180: * @return mixed || null
181: */
182: public function get($strKey);
183:
184: /**
185: * Set the additional information.
186: *
187: * @param string $strKey The name of the information to retrieve.
188: *
189: * @param mixed $varValue The value to store.
190: *
191: * @return ConfigInterface
192: */
193: public function set($strKey, $varValue);
194: }
195: