Passed
Push — master ( 3ac2eb...9ad972 )
by Aimeos
05:39
created

Standard::prefix()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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