Passed
Push — master ( 8673f8...5c56ce )
by Aimeos
04:42
created

Standard::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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