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

Standard::fetch()   A

Complexity

Conditions 6
Paths 18

Size

Total Lines 31
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 15
c 0
b 0
f 0
dl 0
loc 31
rs 9.2222
cc 6
nc 18
nop 4

1 Method

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