1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
5
|
|
|
* @copyright Aimeos (aimeos.org), 2019 |
6
|
|
|
* @package MShop |
7
|
|
|
* @subpackage Price |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
|
11
|
|
|
namespace Aimeos\MShop\Price\Manager\Property; |
12
|
|
|
|
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Default price property manager implementation. |
16
|
|
|
* |
17
|
|
|
* @package MShop |
18
|
|
|
* @subpackage Price |
19
|
|
|
*/ |
20
|
|
|
class Standard |
21
|
|
|
extends \Aimeos\MShop\Common\Manager\Property\Base |
22
|
|
|
implements \Aimeos\MShop\Price\Manager\Property\Iface, \Aimeos\MShop\Common\Manager\Factory\Iface |
23
|
|
|
{ |
24
|
|
|
private $searchConfig = array( |
25
|
|
|
'price.property.id' => array( |
26
|
|
|
'code' => 'price.property.id', |
27
|
|
|
'internalcode' => 'mpripr."id"', |
28
|
|
|
'label' => 'Property ID', |
29
|
|
|
'type' => 'integer', |
30
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
31
|
|
|
'public' => false, |
32
|
|
|
), |
33
|
|
|
'price.property.parentid' => array( |
34
|
|
|
'code' => 'price.property.parentid', |
35
|
|
|
'internalcode' => 'mpripr."parentid"', |
36
|
|
|
'label' => 'Property parent ID', |
37
|
|
|
'type' => 'integer', |
38
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
39
|
|
|
'public' => false, |
40
|
|
|
), |
41
|
|
|
'price.property.siteid' => array( |
42
|
|
|
'code' => 'price.property.siteid', |
43
|
|
|
'internalcode' => 'mpripr."siteid"', |
44
|
|
|
'label' => 'Property site ID', |
45
|
|
|
'type' => 'integer', |
46
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
47
|
|
|
'public' => false, |
48
|
|
|
), |
49
|
|
|
'price.property.type' => array( |
50
|
|
|
'code' => 'price.property.type', |
51
|
|
|
'internalcode' => 'mpripr."type"', |
52
|
|
|
'label' => 'Property type', |
53
|
|
|
'type' => 'string', |
54
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
55
|
|
|
), |
56
|
|
|
'price.property.value' => array( |
57
|
|
|
'code' => 'price.property.value', |
58
|
|
|
'internalcode' => 'mpripr."value"', |
59
|
|
|
'label' => 'Property value', |
60
|
|
|
'type' => 'string', |
61
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
62
|
|
|
), |
63
|
|
|
'price.property.languageid' => array( |
64
|
|
|
'code' => 'price.property.languageid', |
65
|
|
|
'internalcode' => 'mpripr."langid"', |
66
|
|
|
'label' => 'Property language ID', |
67
|
|
|
'type' => 'string', |
68
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
69
|
|
|
), |
70
|
|
|
'price.property.ctime' => array( |
71
|
|
|
'code' => 'price.property.ctime', |
72
|
|
|
'internalcode' => 'mpripr."ctime"', |
73
|
|
|
'label' => 'Property create date/time', |
74
|
|
|
'type' => 'datetime', |
75
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
76
|
|
|
'public' => false, |
77
|
|
|
), |
78
|
|
|
'price.property.mtime' => array( |
79
|
|
|
'code' => 'price.property.mtime', |
80
|
|
|
'internalcode' => 'mpripr."mtime"', |
81
|
|
|
'label' => 'Property modify date', |
82
|
|
|
'type' => 'datetime', |
83
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
84
|
|
|
'public' => false, |
85
|
|
|
), |
86
|
|
|
'price.property.editor' => array( |
87
|
|
|
'code' => 'price.property.editor', |
88
|
|
|
'internalcode' => 'mpripr."editor"', |
89
|
|
|
'label' => 'Property editor', |
90
|
|
|
'type' => 'string', |
91
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
92
|
|
|
'public' => false, |
93
|
|
|
), |
94
|
|
|
); |
95
|
|
|
|
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* Initializes the object. |
99
|
|
|
* |
100
|
|
|
* @param \Aimeos\MShop\Context\Item\Iface $context Context object |
101
|
|
|
*/ |
102
|
|
|
public function __construct( \Aimeos\MShop\Context\Item\Iface $context ) |
103
|
|
|
{ |
104
|
|
|
parent::__construct( $context ); |
105
|
|
|
$this->setResourceName( 'db-price' ); |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* Removes old entries from the storage. |
111
|
|
|
* |
112
|
|
|
* @param string[] $siteids List of IDs for sites whose entries should be deleted |
113
|
|
|
* @return \Aimeos\MShop\Price\Manager\Property\Iface Manager object for chaining method calls |
114
|
|
|
*/ |
115
|
|
|
public function cleanup( array $siteids ) |
116
|
|
|
{ |
117
|
|
|
$path = 'mshop/price/manager/property/submanagers'; |
118
|
|
|
foreach( $this->getContext()->getConfig()->get( $path, ['type'] ) as $domain ) { |
119
|
|
|
$this->getObject()->getSubManager( $domain )->cleanup( $siteids ); |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
return $this->cleanupBase( $siteids, 'mshop/price/manager/property/standard/delete' ); |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* Returns the available manager types |
128
|
|
|
* |
129
|
|
|
* @param boolean $withsub Return also the resource type of sub-managers if true |
130
|
|
|
* @return string[] Type of the manager and submanagers, subtypes are separated by slashes |
131
|
|
|
*/ |
132
|
|
|
public function getResourceType( $withsub = true ) |
133
|
|
|
{ |
134
|
|
|
$path = 'mshop/price/manager/property/submanagers'; |
135
|
|
|
return $this->getResourceTypeBase( 'price/property', $path, [], $withsub ); |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* Returns the prices that can be used for searching. |
141
|
|
|
* |
142
|
|
|
* @param boolean $withsub Return also prices of sub-managers if true |
143
|
|
|
* @return \Aimeos\MW\Criteria\Attribute\Iface[] List of search attribute items |
144
|
|
|
*/ |
145
|
|
|
public function getSearchAttributes( $withsub = true ) |
146
|
|
|
{ |
147
|
|
|
/** mshop/price/manager/property/submanagers |
148
|
|
|
* List of manager names that can be instantiated by the price property manager |
149
|
|
|
* |
150
|
|
|
* Managers provide a generic interface to the underlying storage. |
151
|
|
|
* Each manager has or can have sub-managers caring about particular |
152
|
|
|
* aspects. Each of these sub-managers can be instantiated by its |
153
|
|
|
* parent manager using the getSubManager() method. |
154
|
|
|
* |
155
|
|
|
* The search keys from sub-managers can be normally used in the |
156
|
|
|
* manager as well. It allows you to search for items of the manager |
157
|
|
|
* using the search keys of the sub-managers to further limit the |
158
|
|
|
* retrieved list of items. |
159
|
|
|
* |
160
|
|
|
* @param array List of sub-manager names |
161
|
|
|
* @since 2018.01 |
162
|
|
|
* @category Developer |
163
|
|
|
*/ |
164
|
|
|
$path = 'mshop/price/manager/property/submanagers'; |
165
|
|
|
|
166
|
|
|
return $this->getSearchAttributesBase( $this->searchConfig, $path, [], $withsub ); |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
|
170
|
|
|
/** |
171
|
|
|
* Returns a new manager for price extensions |
172
|
|
|
* |
173
|
|
|
* @param string $manager Name of the sub manager type in lower case |
174
|
|
|
* @param string|null $name Name of the implementation, will be from |
175
|
|
|
* configuration (or Default) if null |
176
|
|
|
* @return \Aimeos\MShop\Common\Manager\Iface Manager for different extensions, e.g property types, property lists etc. |
177
|
|
|
*/ |
178
|
|
|
public function getSubManager( $manager, $name = null ) |
179
|
|
|
{ |
180
|
|
|
/** mshop/price/manager/property/name |
181
|
|
|
* Class name of the used price property manager implementation |
182
|
|
|
* |
183
|
|
|
* Each default price property manager can be replaced by an alternative imlementation. |
184
|
|
|
* To use this implementation, you have to set the last part of the class |
185
|
|
|
* name as configuration value so the manager factory knows which class it |
186
|
|
|
* has to instantiate. |
187
|
|
|
* |
188
|
|
|
* For example, if the name of the default class is |
189
|
|
|
* |
190
|
|
|
* \Aimeos\MShop\Price\Manager\Property\Standard |
191
|
|
|
* |
192
|
|
|
* and you want to replace it with your own version named |
193
|
|
|
* |
194
|
|
|
* \Aimeos\MShop\Price\Manager\Property\Myproperty |
195
|
|
|
* |
196
|
|
|
* then you have to set the this configuration option: |
197
|
|
|
* |
198
|
|
|
* mshop/price/manager/property/name = Myproperty |
199
|
|
|
* |
200
|
|
|
* The value is the last part of your own class name and it's case sensitive, |
201
|
|
|
* so take care that the configuration value is exactly named like the last |
202
|
|
|
* part of the class name. |
203
|
|
|
* |
204
|
|
|
* The allowed characters of the class name are A-Z, a-z and 0-9. No other |
205
|
|
|
* characters are possible! You should always start the last part of the class |
206
|
|
|
* name with an upper case character and continue only with lower case characters |
207
|
|
|
* or numbers. Avoid chamel case names like "MyProperty"! |
208
|
|
|
* |
209
|
|
|
* @param string Last part of the class name |
210
|
|
|
* @since 2018.01 |
211
|
|
|
* @category Developer |
212
|
|
|
*/ |
213
|
|
|
|
214
|
|
|
/** mshop/price/manager/property/decorators/excludes |
215
|
|
|
* Excludes decorators added by the "common" option from the price property manager |
216
|
|
|
* |
217
|
|
|
* Decorators extend the functionality of a class by adding new aspects |
218
|
|
|
* (e.g. log what is currently done), executing the methods of the underlying |
219
|
|
|
* class only in certain conditions (e.g. only for logged in users) or |
220
|
|
|
* modify what is returned to the caller. |
221
|
|
|
* |
222
|
|
|
* This option allows you to remove a decorator added via |
223
|
|
|
* "mshop/common/manager/decorators/default" before they are wrapped |
224
|
|
|
* around the price property manager. |
225
|
|
|
* |
226
|
|
|
* mshop/price/manager/property/decorators/excludes = array( 'decorator1' ) |
227
|
|
|
* |
228
|
|
|
* This would remove the decorator named "decorator1" from the list of |
229
|
|
|
* common decorators ("\Aimeos\MShop\Common\Manager\Decorator\*") added via |
230
|
|
|
* "mshop/common/manager/decorators/default" for the price property manager. |
231
|
|
|
* |
232
|
|
|
* @param array List of decorator names |
233
|
|
|
* @since 2018.01 |
234
|
|
|
* @category Developer |
235
|
|
|
* @see mshop/common/manager/decorators/default |
236
|
|
|
* @see mshop/price/manager/property/decorators/global |
237
|
|
|
* @see mshop/price/manager/property/decorators/local |
238
|
|
|
*/ |
239
|
|
|
|
240
|
|
|
/** mshop/price/manager/property/decorators/global |
241
|
|
|
* Adds a list of globally available decorators only to the price property manager |
242
|
|
|
* |
243
|
|
|
* Decorators extend the functionality of a class by adding new aspects |
244
|
|
|
* (e.g. log what is currently done), executing the methods of the underlying |
245
|
|
|
* class only in certain conditions (e.g. only for logged in users) or |
246
|
|
|
* modify what is returned to the caller. |
247
|
|
|
* |
248
|
|
|
* This option allows you to wrap global decorators |
249
|
|
|
* ("\Aimeos\MShop\Common\Manager\Decorator\*") around the price property |
250
|
|
|
* manager. |
251
|
|
|
* |
252
|
|
|
* mshop/price/manager/property/decorators/global = array( 'decorator1' ) |
253
|
|
|
* |
254
|
|
|
* This would add the decorator named "decorator1" defined by |
255
|
|
|
* "\Aimeos\MShop\Common\Manager\Decorator\Decorator1" only to the price |
256
|
|
|
* property manager. |
257
|
|
|
* |
258
|
|
|
* @param array List of decorator names |
259
|
|
|
* @since 2018.01 |
260
|
|
|
* @category Developer |
261
|
|
|
* @see mshop/common/manager/decorators/default |
262
|
|
|
* @see mshop/price/manager/property/decorators/excludes |
263
|
|
|
* @see mshop/price/manager/property/decorators/local |
264
|
|
|
*/ |
265
|
|
|
|
266
|
|
|
/** mshop/price/manager/property/decorators/local |
267
|
|
|
* Adds a list of local decorators only to the price property manager |
268
|
|
|
* |
269
|
|
|
* Decorators extend the functionality of a class by adding new aspects |
270
|
|
|
* (e.g. log what is currently done), executing the methods of the underlying |
271
|
|
|
* class only in certain conditions (e.g. only for logged in users) or |
272
|
|
|
* modify what is returned to the caller. |
273
|
|
|
* |
274
|
|
|
* This option allows you to wrap local decorators |
275
|
|
|
* ("\Aimeos\MShop\Price\Manager\Property\Decorator\*") around the price |
276
|
|
|
* property manager. |
277
|
|
|
* |
278
|
|
|
* mshop/price/manager/property/decorators/local = array( 'decorator2' ) |
279
|
|
|
* |
280
|
|
|
* This would add the decorator named "decorator2" defined by |
281
|
|
|
* "\Aimeos\MShop\Price\Manager\Property\Decorator\Decorator2" only to the |
282
|
|
|
* price property manager. |
283
|
|
|
* |
284
|
|
|
* @param array List of decorator names |
285
|
|
|
* @since 2018.01 |
286
|
|
|
* @category Developer |
287
|
|
|
* @see mshop/common/manager/decorators/default |
288
|
|
|
* @see mshop/price/manager/property/decorators/excludes |
289
|
|
|
* @see mshop/price/manager/property/decorators/global |
290
|
|
|
*/ |
291
|
|
|
|
292
|
|
|
return $this->getSubManagerBase( 'price', 'property/' . $manager, $name ); |
293
|
|
|
} |
294
|
|
|
|
295
|
|
|
|
296
|
|
|
/** |
297
|
|
|
* Returns the config path for retrieving the configuration values. |
298
|
|
|
* |
299
|
|
|
* @return string Configuration path |
300
|
|
|
*/ |
301
|
|
|
protected function getConfigPath() |
302
|
|
|
{ |
303
|
|
|
/** mshop/price/manager/property/standard/insert/mysql |
304
|
|
|
* Inserts a new price property record into the database table |
305
|
|
|
* |
306
|
|
|
* @see mshop/price/manager/property/standard/insert/ansi |
307
|
|
|
*/ |
308
|
|
|
|
309
|
|
|
/** mshop/price/manager/property/standard/insert/ansi |
310
|
|
|
* Inserts a new price property record into the database table |
311
|
|
|
* |
312
|
|
|
* Items with no ID yet (i.e. the ID is NULL) will be created in |
313
|
|
|
* the database and the newly created ID retrieved afterwards |
314
|
|
|
* using the "newid" SQL statement. |
315
|
|
|
* |
316
|
|
|
* The SQL statement must be a string suitable for being used as |
317
|
|
|
* prepared statement. It must include question marks for binding |
318
|
|
|
* the values from the price property item to the statement before they are |
319
|
|
|
* sent to the database server. The number of question marks must |
320
|
|
|
* be the same as the number of columns listed in the INSERT |
321
|
|
|
* statement. The order of the columns must correspond to the |
322
|
|
|
* order in the saveItems() method, so the correct values are |
323
|
|
|
* bound to the columns. |
324
|
|
|
* |
325
|
|
|
* The SQL statement should conform to the ANSI standard to be |
326
|
|
|
* compatible with most relational database systems. This also |
327
|
|
|
* includes using double quotes for table and column names. |
328
|
|
|
* |
329
|
|
|
* @param string SQL statement for inserting records |
330
|
|
|
* @since 2018.01 |
331
|
|
|
* @category Developer |
332
|
|
|
* @see mshop/price/manager/property/standard/update/ansi |
333
|
|
|
* @see mshop/price/manager/property/standard/newid/ansi |
334
|
|
|
* @see mshop/price/manager/property/standard/delete/ansi |
335
|
|
|
* @see mshop/price/manager/property/standard/search/ansi |
336
|
|
|
* @see mshop/price/manager/property/standard/count/ansi |
337
|
|
|
*/ |
338
|
|
|
|
339
|
|
|
/** mshop/price/manager/property/standard/update/mysql |
340
|
|
|
* Updates an existing price property record in the database |
341
|
|
|
* |
342
|
|
|
* @see mshop/price/manager/property/standard/update/ansi |
343
|
|
|
*/ |
344
|
|
|
|
345
|
|
|
/** mshop/price/manager/property/standard/update/ansi |
346
|
|
|
* Updates an existing price property record in the database |
347
|
|
|
* |
348
|
|
|
* Items which already have an ID (i.e. the ID is not NULL) will |
349
|
|
|
* be updated in the database. |
350
|
|
|
* |
351
|
|
|
* The SQL statement must be a string suitable for being used as |
352
|
|
|
* prepared statement. It must include question marks for binding |
353
|
|
|
* the values from the price property item to the statement before they are |
354
|
|
|
* sent to the database server. The order of the columns must |
355
|
|
|
* correspond to the order in the saveItems() method, so the |
356
|
|
|
* correct values are bound to the columns. |
357
|
|
|
* |
358
|
|
|
* The SQL statement should conform to the ANSI standard to be |
359
|
|
|
* compatible with most relational database systems. This also |
360
|
|
|
* includes using double quotes for table and column names. |
361
|
|
|
* |
362
|
|
|
* @param string SQL statement for updating records |
363
|
|
|
* @since 2018.01 |
364
|
|
|
* @category Developer |
365
|
|
|
* @see mshop/price/manager/property/standard/insert/ansi |
366
|
|
|
* @see mshop/price/manager/property/standard/newid/ansi |
367
|
|
|
* @see mshop/price/manager/property/standard/delete/ansi |
368
|
|
|
* @see mshop/price/manager/property/standard/search/ansi |
369
|
|
|
* @see mshop/price/manager/property/standard/count/ansi |
370
|
|
|
*/ |
371
|
|
|
|
372
|
|
|
/** mshop/price/manager/property/standard/newid/mysql |
373
|
|
|
* Retrieves the ID generated by the database when inserting a new record |
374
|
|
|
* |
375
|
|
|
* @see mshop/price/manager/property/standard/newid/ansi |
376
|
|
|
*/ |
377
|
|
|
|
378
|
|
|
/** mshop/price/manager/property/standard/newid/ansi |
379
|
|
|
* Retrieves the ID generated by the database when inserting a new record |
380
|
|
|
* |
381
|
|
|
* As soon as a new record is inserted into the database table, |
382
|
|
|
* the database server generates a new and unique identifier for |
383
|
|
|
* that record. This ID can be used for retrieving, updating and |
384
|
|
|
* deleting that specific record from the table again. |
385
|
|
|
* |
386
|
|
|
* For MySQL: |
387
|
|
|
* SELECT LAST_INSERT_ID() |
388
|
|
|
* For PostgreSQL: |
389
|
|
|
* SELECT currval('seq_mpripr_id') |
390
|
|
|
* For SQL Server: |
391
|
|
|
* SELECT SCOPE_IDENTITY() |
392
|
|
|
* For Oracle: |
393
|
|
|
* SELECT "seq_mpripr_id".CURRVAL FROM DUAL |
394
|
|
|
* |
395
|
|
|
* There's no way to retrive the new ID by a SQL statements that |
396
|
|
|
* fits for most database servers as they implement their own |
397
|
|
|
* specific way. |
398
|
|
|
* |
399
|
|
|
* @param string SQL statement for retrieving the last inserted record ID |
400
|
|
|
* @since 2018.01 |
401
|
|
|
* @category Developer |
402
|
|
|
* @see mshop/price/manager/property/standard/insert/ansi |
403
|
|
|
* @see mshop/price/manager/property/standard/update/ansi |
404
|
|
|
* @see mshop/price/manager/property/standard/delete/ansi |
405
|
|
|
* @see mshop/price/manager/property/standard/search/ansi |
406
|
|
|
* @see mshop/price/manager/property/standard/count/ansi |
407
|
|
|
*/ |
408
|
|
|
|
409
|
|
|
/** mshop/price/manager/property/standard/delete/mysql |
410
|
|
|
* Deletes the items matched by the given IDs from the database |
411
|
|
|
* |
412
|
|
|
* @see mshop/price/manager/property/standard/delete/ansi |
413
|
|
|
*/ |
414
|
|
|
|
415
|
|
|
/** mshop/price/manager/property/standard/delete/ansi |
416
|
|
|
* Deletes the items matched by the given IDs from the database |
417
|
|
|
* |
418
|
|
|
* Removes the records specified by the given IDs from the price database. |
419
|
|
|
* The records must be from the site that is configured via the |
420
|
|
|
* context item. |
421
|
|
|
* |
422
|
|
|
* The ":cond" placeholder is replaced by the name of the ID column and |
423
|
|
|
* the given ID or list of IDs while the site ID is bound to the question |
424
|
|
|
* mark. |
425
|
|
|
* |
426
|
|
|
* The SQL statement should conform to the ANSI standard to be |
427
|
|
|
* compatible with most relational database systems. This also |
428
|
|
|
* includes using double quotes for table and column names. |
429
|
|
|
* |
430
|
|
|
* @param string SQL statement for deleting items |
431
|
|
|
* @since 2018.01 |
432
|
|
|
* @category Developer |
433
|
|
|
* @see mshop/price/manager/property/standard/insert/ansi |
434
|
|
|
* @see mshop/price/manager/property/standard/update/ansi |
435
|
|
|
* @see mshop/price/manager/property/standard/newid/ansi |
436
|
|
|
* @see mshop/price/manager/property/standard/search/ansi |
437
|
|
|
* @see mshop/price/manager/property/standard/count/ansi |
438
|
|
|
*/ |
439
|
|
|
|
440
|
|
|
/** mshop/price/manager/property/standard/search/mysql |
441
|
|
|
* Retrieves the records matched by the given criteria in the database |
442
|
|
|
* |
443
|
|
|
* @see mshop/price/manager/property/standard/search/ansi |
444
|
|
|
*/ |
445
|
|
|
|
446
|
|
|
/** mshop/price/manager/property/standard/search/ansi |
447
|
|
|
* Retrieves the records matched by the given criteria in the database |
448
|
|
|
* |
449
|
|
|
* Fetches the records matched by the given criteria from the price |
450
|
|
|
* database. The records must be from one of the sites that are |
451
|
|
|
* configured via the context item. If the current site is part of |
452
|
|
|
* a tree of sites, the SELECT statement can retrieve all records |
453
|
|
|
* from the current site and the complete sub-tree of sites. |
454
|
|
|
* |
455
|
|
|
* As the records can normally be limited by criteria from sub-managers, |
456
|
|
|
* their tables must be joined in the SQL context. This is done by |
457
|
|
|
* using the "internaldeps" property from the definition of the ID |
458
|
|
|
* column of the sub-managers. These internal dependencies specify |
459
|
|
|
* the JOIN between the tables and the used columns for joining. The |
460
|
|
|
* ":joins" placeholder is then replaced by the JOIN strings from |
461
|
|
|
* the sub-managers. |
462
|
|
|
* |
463
|
|
|
* To limit the records matched, conditions can be added to the given |
464
|
|
|
* criteria object. It can contain comparisons like column names that |
465
|
|
|
* must match specific values which can be combined by AND, OR or NOT |
466
|
|
|
* operators. The resulting string of SQL conditions replaces the |
467
|
|
|
* ":cond" placeholder before the statement is sent to the database |
468
|
|
|
* server. |
469
|
|
|
* |
470
|
|
|
* If the records that are retrieved should be ordered by one or more |
471
|
|
|
* columns, the generated string of column / sort direction pairs |
472
|
|
|
* replaces the ":order" placeholder. In case no ordering is required, |
473
|
|
|
* the complete ORDER BY part including the "\/*-orderby*\/...\/*orderby-*\/" |
474
|
|
|
* markers is removed to speed up retrieving the records. Columns of |
475
|
|
|
* sub-managers can also be used for ordering the result set but then |
476
|
|
|
* no index can be used. |
477
|
|
|
* |
478
|
|
|
* The number of returned records can be limited and can start at any |
479
|
|
|
* number between the begining and the end of the result set. For that |
480
|
|
|
* the ":size" and ":start" placeholders are replaced by the |
481
|
|
|
* corresponding values from the criteria object. The default values |
482
|
|
|
* are 0 for the start and 100 for the size value. |
483
|
|
|
* |
484
|
|
|
* The SQL statement should conform to the ANSI standard to be |
485
|
|
|
* compatible with most relational database systems. This also |
486
|
|
|
* includes using double quotes for table and column names. |
487
|
|
|
* |
488
|
|
|
* @param string SQL statement for searching items |
489
|
|
|
* @since 2018.01 |
490
|
|
|
* @category Developer |
491
|
|
|
* @see mshop/price/manager/property/standard/insert/ansi |
492
|
|
|
* @see mshop/price/manager/property/standard/update/ansi |
493
|
|
|
* @see mshop/price/manager/property/standard/newid/ansi |
494
|
|
|
* @see mshop/price/manager/property/standard/delete/ansi |
495
|
|
|
* @see mshop/price/manager/property/standard/count/ansi |
496
|
|
|
*/ |
497
|
|
|
|
498
|
|
|
/** mshop/price/manager/property/standard/count/mysql |
499
|
|
|
* Counts the number of records matched by the given criteria in the database |
500
|
|
|
* |
501
|
|
|
* @see mshop/price/manager/property/standard/count/ansi |
502
|
|
|
*/ |
503
|
|
|
|
504
|
|
|
/** mshop/price/manager/property/standard/count/ansi |
505
|
|
|
* Counts the number of records matched by the given criteria in the database |
506
|
|
|
* |
507
|
|
|
* Counts all records matched by the given criteria from the price |
508
|
|
|
* database. The records must be from one of the sites that are |
509
|
|
|
* configured via the context item. If the current site is part of |
510
|
|
|
* a tree of sites, the statement can count all records from the |
511
|
|
|
* current site and the complete sub-tree of sites. |
512
|
|
|
* |
513
|
|
|
* As the records can normally be limited by criteria from sub-managers, |
514
|
|
|
* their tables must be joined in the SQL context. This is done by |
515
|
|
|
* using the "internaldeps" property from the definition of the ID |
516
|
|
|
* column of the sub-managers. These internal dependencies specify |
517
|
|
|
* the JOIN between the tables and the used columns for joining. The |
518
|
|
|
* ":joins" placeholder is then replaced by the JOIN strings from |
519
|
|
|
* the sub-managers. |
520
|
|
|
* |
521
|
|
|
* To limit the records matched, conditions can be added to the given |
522
|
|
|
* criteria object. It can contain comparisons like column names that |
523
|
|
|
* must match specific values which can be combined by AND, OR or NOT |
524
|
|
|
* operators. The resulting string of SQL conditions replaces the |
525
|
|
|
* ":cond" placeholder before the statement is sent to the database |
526
|
|
|
* server. |
527
|
|
|
* |
528
|
|
|
* Both, the strings for ":joins" and for ":cond" are the same as for |
529
|
|
|
* the "search" SQL statement. |
530
|
|
|
* |
531
|
|
|
* Contrary to the "search" statement, it doesn't return any records |
532
|
|
|
* but instead the number of records that have been found. As counting |
533
|
|
|
* thousands of records can be a long running task, the maximum number |
534
|
|
|
* of counted records is limited for performance reasons. |
535
|
|
|
* |
536
|
|
|
* The SQL statement should conform to the ANSI standard to be |
537
|
|
|
* compatible with most relational database systems. This also |
538
|
|
|
* includes using double quotes for table and column names. |
539
|
|
|
* |
540
|
|
|
* @param string SQL statement for counting items |
541
|
|
|
* @since 2018.01 |
542
|
|
|
* @category Developer |
543
|
|
|
* @see mshop/price/manager/property/standard/insert/ansi |
544
|
|
|
* @see mshop/price/manager/property/standard/update/ansi |
545
|
|
|
* @see mshop/price/manager/property/standard/newid/ansi |
546
|
|
|
* @see mshop/price/manager/property/standard/delete/ansi |
547
|
|
|
* @see mshop/price/manager/property/standard/search/ansi |
548
|
|
|
*/ |
549
|
|
|
|
550
|
|
|
return 'mshop/price/manager/property/standard/'; |
551
|
|
|
} |
552
|
|
|
|
553
|
|
|
|
554
|
|
|
/** |
555
|
|
|
* Returns the search configuration for searching items. |
556
|
|
|
* |
557
|
|
|
* @return array Associative list of search keys and search definitions |
558
|
|
|
*/ |
559
|
|
|
protected function getSearchConfig() |
560
|
|
|
{ |
561
|
|
|
return $this->searchConfig; |
562
|
|
|
} |
563
|
|
|
} |
564
|
|
|
|