Passed
Push — master ( 9f1c00...0115e8 )
by Aimeos
05:45
created

Standard::saveItem()   B

Complexity

Conditions 7
Paths 17

Size

Total Lines 161
Code Lines 36

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 36
dl 0
loc 161
rs 8.4106
c 0
b 0
f 0
cc 7
nc 17
nop 2

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

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