• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

aimeos / aimeos-core / e67a5171-b485-4a8f-9441-93d8ff5aa19b

15 Aug 2024 11:37AM UTC coverage: 91.967% (+0.03%) from 91.933%
e67a5171-b485-4a8f-9441-93d8ff5aa19b

push

circleci

aimeos
Simplified order service manager

111 of 117 new or added lines in 4 files covered. (94.87%)

5 existing lines in 3 files now uncovered.

10246 of 11141 relevant lines covered (91.97%)

61.76 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

98.61
/src/MShop/Order/Manager/Service/Transaction/Standard.php
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';
1✔
108
                return $this->aggregateBase( $search, $key, $cfgkey, ['order.service.transaction'], $value, $type );
1✔
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();
24✔
121

122
                $values['.price'] = $values['.price'] ?? \Aimeos\MShop::create( $context, 'price' )->create();
24✔
123
                $values['order.service.transaction.siteid'] = $values['order.service.transaction.siteid'] ?? $context->locale()->getSiteId();
24✔
124

125
                return new \Aimeos\MShop\Order\Item\Service\Transaction\Standard( 'order.service.transaction.', $values );
24✔
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 );
99✔
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( [
99✔
149
                        'order.service.transaction.id' => [
99✔
150
                                'label' => 'Service transaction ID',
99✔
151
                                'internaldeps' => [ 'LEFT JOIN "mshop_order_service_tx" AS mordsetx ON ( mordse."id" = mordsetx."parentid" )' ],
99✔
152
                                'internalcode' => 'id',
99✔
153
                                'type' => 'int',
99✔
154
                                'public' => false,
99✔
155
                        ],
99✔
156
                        'order.service.transaction.currencyid' => [
99✔
157
                                'label' => 'Service currencyid code',
99✔
158
                                'internalcode' => 'currencyid',
99✔
159
                        ],
99✔
160
                        'order.service.transaction.price' => [
99✔
161
                                'label' => 'Service price',
99✔
162
                                'internalcode' => 'price',
99✔
163
                                'type' => 'decimal',
99✔
164
                        ],
99✔
165
                        'order.service.transaction.costs' => [
99✔
166
                                'label' => 'Service shipping',
99✔
167
                                'internalcode' => 'costs',
99✔
168
                                'type' => 'decimal',
99✔
169
                        ],
99✔
170
                        'order.service.transaction.rebate' => [
99✔
171
                                'label' => 'Service rebate',
99✔
172
                                'internalcode' => 'rebate',
99✔
173
                                'type' => 'decimal',
99✔
174
                        ],
99✔
175
                        'order.service.transaction.taxvalue' => [
99✔
176
                                'label' => 'Service tax value',
99✔
177
                                'internalcode' => 'tax',
99✔
178
                                'type' => 'decimal',
99✔
179
                        ],
99✔
180
                        'order.service.transaction.taxflag' => [
99✔
181
                                'label' => 'Service tax flag (0=net, 1=gross)',
99✔
182
                                'internalcode' => 'taxflag',
99✔
183
                                'type' => 'int',
99✔
184
                        ],
99✔
185
                ] ) );
99✔
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';
51✔
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();
1✔
212

213
                $stmt->bind( $idx++, $price->getCurrencyId() );
1✔
214
                $stmt->bind( $idx++, $price->getValue() );
1✔
215
                $stmt->bind( $idx++, $price->getCosts() );
1✔
216
                $stmt->bind( $idx++, $price->getRebate() );
1✔
217
                $stmt->bind( $idx++, $price->getTaxValue() );
1✔
218
                $stmt->bind( $idx++, $price->getTaxFlag(), \Aimeos\Base\DB\Statement\Base::PARAM_INT );
1✔
219

220
                return $stmt;
1✔
221
        }
222

223

224
        /**
225
         * Fetches the rows from the database statement and returns the list of items.
226
         *
227
         * @param \Aimeos\Base\DB\Result\Iface $stmt Database statement object
228
         * @param array $ref List of domains whose items should be fetched too
229
         * @param string $prefix Prefix for the property names
230
         * @param array $attrs List of attributes that should be decoded
231
         * @return \Aimeos\Map List of items implementing \Aimeos\MShop\Common\Item\Iface
232
         */
233
        protected function fetch( \Aimeos\Base\DB\Result\Iface $results, array $ref, string $prefix = '', array $attrs = [] ) : \Aimeos\Map
234
        {
235
                $items = [];
44✔
236
                $priceManager = \Aimeos\MShop::create( $this->context(), 'price' );
44✔
237

238
                while( $row = $results->fetch() )
44✔
239
                {
240
                        if( ( $row['order.service.transaction.config'] = json_decode( $row['order.service.transaction.config'], true ) ) === null ) {
22✔
UNCOV
241
                                $row['order.service.transaction.config'] = [];
×
242
                        }
243

244
                        // don't use fromArray() or set*() methods to avoid recalculation of tax value
245
                        $row['.price'] = $priceManager->create( [
22✔
246
                                'price.currencyid' => $row['order.service.transaction.currencyid'],
22✔
247
                                'price.value' => $row['order.service.transaction.price'],
22✔
248
                                'price.costs' => $row['order.service.transaction.costs'],
22✔
249
                                'price.rebate' => $row['order.service.transaction.rebate'],
22✔
250
                                'price.taxflag' => $row['order.service.transaction.taxflag'],
22✔
251
                                'price.taxvalue' => $row['order.service.transaction.taxvalue'],
22✔
252
                        ] );
22✔
253

254
                        if( $item = $this->applyFilter( $this->create( $row ) ) ) {
22✔
255
                                $items[$row['order.service.transaction.id']] = $item;
22✔
256
                        }
257
                }
258

259
                return map( $items );
44✔
260
        }
261

262

263
        /**
264
         * Returns the name of the used table
265
         *
266
         * @return string Table name e.g. "mshop_service_lists_type"
267
         */
268
        protected function getTable() : string
269
        {
270
                return 'mshop_order_service_tx';
51✔
271
        }
272

273

274
        /**
275
         * Returns the prefix for the item properties and search keys.
276
         *
277
         * @return string Prefix for the item properties and search keys
278
         */
279
        protected function prefix() : string
280
        {
281
                return 'order.service.transaction.';
99✔
282
        }
283

284

285
        /** mshop/order/manager/service/transaction/delete/mysql
286
         * Deletes the items matched by the given IDs from the database
287
         *
288
         * @see mshop/order/manager/service/transaction/delete/ansi
289
         */
290

291
        /** mshop/order/manager/service/transaction/delete/ansi
292
         * Deletes the items matched by the given IDs from the database
293
         *
294
         * Removes the records specified by the given IDs from the order database.
295
         * The records must be from the site that is configured via the
296
         * context item.
297
         *
298
         * The ":cond" placeholder is replaced by the name of the ID column and
299
         * the given ID or list of IDs while the site ID is bound to the question
300
         * mark.
301
         *
302
         * The SQL statement should conform to the ANSI standard to be
303
         * compatible with most relational database systems. This also
304
         * includes using double quotes for table and column names.
305
         *
306
         * @param string SQL statement for deleting items
307
         * @since 2015.10
308
         * @see mshop/order/manager/service/transaction/insert/ansi
309
         * @see mshop/order/manager/service/transaction/update/ansi
310
         * @see mshop/order/manager/service/transaction/newid/ansi
311
         * @see mshop/order/manager/service/transaction/search/ansi
312
         * @see mshop/order/manager/service/transaction/count/ansi
313
         */
314

315
        /** mshop/order/manager/service/transaction/submanagers
316
         * List of manager names that can be instantiated by the order service transaction manager
317
         *
318
         * Managers provide a generic interface to the underlying storage.
319
         * Each manager has or can have sub-managers caring about particular
320
         * aspects. Each of these sub-managers can be instantiated by its
321
         * parent manager using the getSubManager() method.
322
         *
323
         * The search keys from sub-managers can be normally used in the
324
         * manager as well. It allows you to search for items of the manager
325
         * using the search keys of the sub-managers to further limit the
326
         * retrieved list of items.
327
         *
328
         * @param array List of sub-manager names
329
         * @since 2015.10
330
         */
331

332
        /** mshop/order/manager/service/transaction/name
333
         * Class name of the used order service transaction manager implementation
334
         *
335
         * Each default order service transaction manager can be replaced by an alternative imlementation.
336
         * To use this implementation, you have to set the last part of the class
337
         * name as configuration value so the manager factory knows which class it
338
         * has to instantiate.
339
         *
340
         * For example, if the name of the default class is
341
         *
342
         *  \Aimeos\MShop\Order\Manager\Service\Transaction\Standard
343
         *
344
         * and you want to replace it with your own version named
345
         *
346
         *  \Aimeos\MShop\Order\Manager\Service\Transaction\Mytransaction
347
         *
348
         * then you have to set the this configuration option:
349
         *
350
         *  mshop/order/manager/service/transaction/name = Mytransaction
351
         *
352
         * The value is the last part of your own class name and it's case sensitive,
353
         * so take care that the configuration value is exactly named like the last
354
         * part of the class name.
355
         *
356
         * The allowed characters of the class name are A-Z, a-z and 0-9. No other
357
         * characters are possible! You should always start the last part of the class
358
         * name with an upper case character and continue only with lower case characters
359
         * or numbers. Avoid chamel case names like "MyTransaction"!
360
         *
361
         * @param string Last part of the class name
362
         * @since 2015.10
363
         */
364

365
        /** mshop/order/manager/service/transaction/decorators/excludes
366
         * Excludes decorators added by the "common" option from the order service transaction manager
367
         *
368
         * Decorators extend the functionality of a class by adding new aspects
369
         * (e.g. log what is currently done), executing the methods of the underlying
370
         * class only in certain conditions (e.g. only for logged in users) or
371
         * modify what is returned to the caller.
372
         *
373
         * This option allows you to remove a decorator added via
374
         * "mshop/common/manager/decorators/default" before they are wrapped
375
         * around the order service transaction manager.
376
         *
377
         *  mshop/order/manager/service/transaction/decorators/excludes = array( 'decorator1' )
378
         *
379
         * This would remove the decorator named "decorator1" from the list of
380
         * common decorators ("\Aimeos\MShop\Common\Manager\Decorator\*") added via
381
         * "mshop/common/manager/decorators/default" for the order service transaction manager.
382
         *
383
         * @param array List of decorator names
384
         * @since 2015.10
385
         * @see mshop/common/manager/decorators/default
386
         * @see mshop/order/manager/service/transaction/decorators/global
387
         * @see mshop/order/manager/service/transaction/decorators/local
388
         */
389

390
        /** mshop/order/manager/service/transaction/decorators/global
391
         * Adds a list of globally available decorators only to the order service transaction manager
392
         *
393
         * Decorators extend the functionality of a class by adding new aspects
394
         * (e.g. log what is currently done), executing the methods of the underlying
395
         * class only in certain conditions (e.g. only for logged in users) or
396
         * modify what is returned to the caller.
397
         *
398
         * This option allows you to wrap global decorators
399
         * ("\Aimeos\MShop\Common\Manager\Decorator\*") around the order
400
         * service transaction manager.
401
         *
402
         *  mshop/order/manager/service/transaction/decorators/global = array( 'decorator1' )
403
         *
404
         * This would add the decorator named "decorator1" defined by
405
         * "\Aimeos\MShop\Common\Manager\Decorator\Decorator1" only to the order
406
         * base service transaction manager.
407
         *
408
         * @param array List of decorator names
409
         * @since 2015.10
410
         * @see mshop/common/manager/decorators/default
411
         * @see mshop/order/manager/service/transaction/decorators/excludes
412
         * @see mshop/order/manager/service/transaction/decorators/local
413
         */
414

415
        /** mshop/order/manager/service/transaction/decorators/local
416
         * Adds a list of local decorators only to the order service transaction manager
417
         *
418
         * Decorators extend the functionality of a class by adding new aspects
419
         * (e.g. log what is currently done), executing the methods of the underlying
420
         * class only in certain conditions (e.g. only for logged in users) or
421
         * modify what is returned to the caller.
422
         *
423
         * This option allows you to wrap local decorators
424
         * ("\Aimeos\MShop\Order\Manager\Service\Transaction\Decorator\*")
425
         * around the order service transaction manager.
426
         *
427
         *  mshop/order/manager/service/transaction/decorators/local = array( 'decorator2' )
428
         *
429
         * This would add the decorator named "decorator2" defined by
430
         * "\Aimeos\MShop\Order\Manager\Service\Transaction\Decorator\Decorator2"
431
         * only to the order service transaction manager.
432
         *
433
         * @param array List of decorator names
434
         * @since 2015.10
435
         * @see mshop/common/manager/decorators/default
436
         * @see mshop/order/manager/service/transaction/decorators/excludes
437
         * @see mshop/order/manager/service/transaction/decorators/global
438
         */
439

440
        /** mshop/order/manager/service/transaction/insert/mysql
441
         * Inserts a new order record into the database table
442
         *
443
         * @see mshop/order/manager/service/transaction/insert/ansi
444
         */
445

446
        /** mshop/order/manager/service/transaction/insert/ansi
447
         * Inserts a new order record into the database table
448
         *
449
         * Items with no ID yet (i.e. the ID is NULL) will be created in
450
         * the database and the newly created ID retrieved afterwards
451
         * using the "newid" SQL statement.
452
         *
453
         * The SQL statement must be a string suitable for being used as
454
         * prepared statement. It must include question marks for binding
455
         * the values from the order item to the statement before they are
456
         * sent to the database server. The number of question marks must
457
         * be the same as the number of columns listed in the INSERT
458
         * statement. The order of the columns must correspond to the
459
         * order in the save() method, so the correct values are
460
         * bound to the columns.
461
         *
462
         * The SQL statement should conform to the ANSI standard to be
463
         * compatible with most relational database systems. This also
464
         * includes using double quotes for table and column names.
465
         *
466
         * @param string SQL statement for inserting records
467
         * @since 2015.10
468
         * @see mshop/order/manager/service/transaction/update/ansi
469
         * @see mshop/order/manager/service/transaction/newid/ansi
470
         * @see mshop/order/manager/service/transaction/delete/ansi
471
         * @see mshop/order/manager/service/transaction/search/ansi
472
         * @see mshop/order/manager/service/transaction/count/ansi
473
         */
474

475
        /** mshop/order/manager/service/transaction/update/mysql
476
         * Updates an existing order record in the database
477
         *
478
         * @see mshop/order/manager/service/transaction/update/ansi
479
         */
480

481
        /** mshop/order/manager/service/transaction/update/ansi
482
         * Updates an existing order record in the database
483
         *
484
         * Items which already have an ID (i.e. the ID is not NULL) will
485
         * be updated in the database.
486
         *
487
         * The SQL statement must be a string suitable for being used as
488
         * prepared statement. It must include question marks for binding
489
         * the values from the order item to the statement before they are
490
         * sent to the database server. The order of the columns must
491
         * correspond to the order in the save() method, so the
492
         * correct values are bound to the columns.
493
         *
494
         * The SQL statement should conform to the ANSI standard to be
495
         * compatible with most relational database systems. This also
496
         * includes using double quotes for table and column names.
497
         *
498
         * @param string SQL statement for updating records
499
         * @since 2015.10
500
         * @see mshop/order/manager/service/transaction/insert/ansi
501
         * @see mshop/order/manager/service/transaction/newid/ansi
502
         * @see mshop/order/manager/service/transaction/delete/ansi
503
         * @see mshop/order/manager/service/transaction/search/ansi
504
         * @see mshop/order/manager/service/transaction/count/ansi
505
         */
506

507
        /** mshop/order/manager/service/transaction/newid/mysql
508
         * Retrieves the ID generated by the database when inserting a new record
509
         *
510
         * @see mshop/order/manager/service/transaction/newid/ansi
511
         */
512

513
        /** mshop/order/manager/service/transaction/newid/ansi
514
         * Retrieves the ID generated by the database when inserting a new record
515
         *
516
         * As soon as a new record is inserted into the database table,
517
         * the database server generates a new and unique identifier for
518
         * that record. This ID can be used for retrieving, updating and
519
         * deleting that specific record from the table again.
520
         *
521
         * For MySQL:
522
         *  SELECT LAST_INSERT_ID()
523
         * For PostgreSQL:
524
         *  SELECT currval('seq_mord_id')
525
         * For SQL Server:
526
         *  SELECT SCOPE_IDENTITY()
527
         * For Oracle:
528
         *  SELECT "seq_mord_id".CURRVAL FROM DUAL
529
         *
530
         * There's no way to retrive the new ID by a SQL statements that
531
         * fits for most database servers as they implement their own
532
         * specific way.
533
         *
534
         * @param string SQL statement for retrieving the last inserted record ID
535
         * @since 2015.10
536
         * @see mshop/order/manager/service/transaction/insert/ansi
537
         * @see mshop/order/manager/service/transaction/update/ansi
538
         * @see mshop/order/manager/service/transaction/delete/ansi
539
         * @see mshop/order/manager/service/transaction/search/ansi
540
         * @see mshop/order/manager/service/transaction/count/ansi
541
         */
542

543
        /** mshop/order/manager/service/transaction/search/mysql
544
         * Retrieves the records matched by the given criteria in the database
545
         *
546
         * @see mshop/order/manager/service/transaction/search/ansi
547
         */
548

549
        /** mshop/order/manager/service/transaction/search/ansi
550
         * Retrieves the records matched by the given criteria in the database
551
         *
552
         * Fetches the records matched by the given criteria from the order
553
         * database. The records must be from one of the sites that are
554
         * configured via the context item. If the current site is part of
555
         * a tree of sites, the SELECT statement can retrieve all records
556
         * from the current site and the complete sub-tree of sites.
557
         *
558
         * As the records can normally be limited by criteria from sub-managers,
559
         * their tables must be joined in the SQL context. This is done by
560
         * using the "internaldeps" property from the definition of the ID
561
         * column of the sub-managers. These internal dependencies specify
562
         * the JOIN between the tables and the used columns for joining. The
563
         * ":joins" placeholder is then replaced by the JOIN strings from
564
         * the sub-managers.
565
         *
566
         * To limit the records matched, conditions can be added to the given
567
         * criteria object. It can contain comparisons like column names that
568
         * must match specific values which can be combined by AND, OR or NOT
569
         * operators. The resulting string of SQL conditions replaces the
570
         * ":cond" placeholder before the statement is sent to the database
571
         * server.
572
         *
573
         * If the records that are retrieved should be ordered by one or more
574
         * columns, the generated string of column / sort direction pairs
575
         * replaces the ":order" placeholder. Columns of
576
         * sub-managers can also be used for ordering the result set but then
577
         * no index can be used.
578
         *
579
         * The number of returned records can be limited and can start at any
580
         * number between the begining and the end of the result set. For that
581
         * the ":size" and ":start" placeholders are replaced by the
582
         * corresponding values from the criteria object. The default values
583
         * are 0 for the start and 100 for the size value.
584
         *
585
         * The SQL statement should conform to the ANSI standard to be
586
         * compatible with most relational database systems. This also
587
         * includes using double quotes for table and column names.
588
         *
589
         * @param string SQL statement for searching items
590
         * @since 2015.10
591
         * @see mshop/order/manager/service/transaction/insert/ansi
592
         * @see mshop/order/manager/service/transaction/update/ansi
593
         * @see mshop/order/manager/service/transaction/newid/ansi
594
         * @see mshop/order/manager/service/transaction/delete/ansi
595
         * @see mshop/order/manager/service/transaction/count/ansi
596
         */
597

598
        /** mshop/order/manager/service/transaction/count/mysql
599
         * Counts the number of records matched by the given criteria in the database
600
         *
601
         * @see mshop/order/manager/service/transaction/count/ansi
602
         */
603

604
        /** mshop/order/manager/service/transaction/count/ansi
605
         * Counts the number of records matched by the given criteria in the database
606
         *
607
         * Counts all records matched by the given criteria from the order
608
         * database. The records must be from one of the sites that are
609
         * configured via the context item. If the current site is part of
610
         * a tree of sites, the statement can count all records from the
611
         * current site and the complete sub-tree of sites.
612
         *
613
         * As the records can normally be limited by criteria from sub-managers,
614
         * their tables must be joined in the SQL context. This is done by
615
         * using the "internaldeps" property from the definition of the ID
616
         * column of the sub-managers. These internal dependencies specify
617
         * the JOIN between the tables and the used columns for joining. The
618
         * ":joins" placeholder is then replaced by the JOIN strings from
619
         * the sub-managers.
620
         *
621
         * To limit the records matched, conditions can be added to the given
622
         * criteria object. It can contain comparisons like column names that
623
         * must match specific values which can be combined by AND, OR or NOT
624
         * operators. The resulting string of SQL conditions replaces the
625
         * ":cond" placeholder before the statement is sent to the database
626
         * server.
627
         *
628
         * Both, the strings for ":joins" and for ":cond" are the same as for
629
         * the "search" SQL statement.
630
         *
631
         * Contrary to the "search" statement, it doesn't return any records
632
         * but instead the number of records that have been found. As counting
633
         * thousands of records can be a long running task, the maximum number
634
         * of counted records is limited for performance reasons.
635
         *
636
         * The SQL statement should conform to the ANSI standard to be
637
         * compatible with most relational database systems. This also
638
         * includes using double quotes for table and column names.
639
         *
640
         * @param string SQL statement for counting items
641
         * @since 2015.10
642
         * @see mshop/order/manager/service/transaction/insert/ansi
643
         * @see mshop/order/manager/service/transaction/update/ansi
644
         * @see mshop/order/manager/service/transaction/newid/ansi
645
         * @see mshop/order/manager/service/transaction/delete/ansi
646
         * @see mshop/order/manager/service/transaction/search/ansi
647
         */
648
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc