Passed
Push — master ( ff8fed...0e6033 )
by Aimeos
06:33 queued 15s
created

Standard::getSubManager()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
rs 10
c 0
b 0
f 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 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
	 * Fetches the rows from the database statement and returns the list of items.
203
	 *
204
	 * @param \Aimeos\Base\DB\Result\Iface $stmt Database statement object
205
	 * @param array $ref List of domains whose items should be fetched too
206
	 * @param string $prefix Prefix for the property names
207
	 * @param array $attrs List of attributes that should be decoded
208
	 * @return \Aimeos\Map List of items implementing \Aimeos\MShop\Common\Item\Iface
209
	 */
210
	protected function fetch( \Aimeos\Base\DB\Result\Iface $results, array $ref, string $prefix = '', array $attrs = [] ) : \Aimeos\Map
211
	{
212
		$map = $items = $parentIds = $addrItems = [];
213
214
		while( $row = $results->fetch() )
215
		{
216
			foreach( $attrs as $code => $attr ) {
217
				$row[$code] = json_decode( $row[$code], true );
218
			}
219
220
			$map[$row['supplier.id']] = $row;
221
			$parentIds[] = $row['supplier.id'];
222
		}
223
224
		if( $this->hasRef( $ref, 'supplier/address' ) ) {
225
			$addrItems = $this->getAddressItems( $parentIds, 'supplier' );
226
		}
227
228
		$listItems = map( $this->getListItems( $parentIds, $ref, 'supplier' ) )->groupBy( 'supplier.lists.parentid' );
229
230
		foreach( $map as $id => $row )
231
		{
232
			$row['.addritems'] = $addrItems[$id] ?? [];
233
			$row['.listitems'] = $listItems[$id] ?? [];
234
235
			if( $item = $this->applyFilter( $this->create( $row ) ) ) {
236
				$items[$id] = $item;
237
			}
238
		}
239
240
		return map( $items );
241
	}
242
243
244
	/**
245
	 * Returns the prefix for the item properties and search keys.
246
	 *
247
	 * @return string Prefix for the item properties and search keys
248
	 */
249
	protected function prefix() : string
250
	{
251
		return 'supplier.';
252
	}
253
254
255
	/**
256
	 * Saves the dependent items of the item
257
	 *
258
	 * @param \Aimeos\MShop\Common\Item\Iface $item Item object
259
	 * @param bool $fetch True if the new ID should be returned in the item
260
	 * @return \Aimeos\MShop\Common\Item\Iface Updated item
261
	 */
262
	protected function saveDeps( \Aimeos\MShop\Common\Item\Iface $item, bool $fetch = true ) : \Aimeos\MShop\Common\Item\Iface
263
	{
264
		$this->saveAddressItems( $item, 'supplier', $fetch );
265
		return $this->saveListItems( $item, 'supplier', $fetch );
266
	}
267
268
269
	/** mshop/supplier/manager/resource
270
	 * Name of the database connection resource to use
271
	 *
272
	 * You can configure a different database connection for each data domain
273
	 * and if no such connection name exists, the "db" connection will be used.
274
	 * It's also possible to use the same database connection for different
275
	 * data domains by configuring the same connection name using this setting.
276
	 *
277
	 * @param string Database connection name
278
	 * @since 2023.04
279
	 */
280
281
	/** mshop/supplier/manager/name
282
	 * Class name of the used supplier manager implementation
283
	 *
284
	 * Each default manager can be replace by an alternative imlementation.
285
	 * To use this implementation, you have to set the last part of the class
286
	 * name as configuration value so the manager factory knows which class it
287
	 * has to instantiate.
288
	 *
289
	 * For example, if the name of the default class is
290
	 *
291
	 *  \Aimeos\MShop\Supplier\Manager\Standard
292
	 *
293
	 * and you want to replace it with your own version named
294
	 *
295
	 *  \Aimeos\MShop\Supplier\Manager\Mymanager
296
	 *
297
	 * then you have to set the this configuration option:
298
	 *
299
	 *  mshop/supplier/manager/name = Mymanager
300
	 *
301
	 * The value is the last part of your own class name and it's case sensitive,
302
	 * so take care that the configuration value is exactly named like the last
303
	 * part of the class name.
304
	 *
305
	 * The allowed characters of the class name are A-Z, a-z and 0-9. No other
306
	 * characters are possible! You should always start the last part of the class
307
	 * name with an upper case character and continue only with lower case characters
308
	 * or numbers. Avoid chamel case names like "MyManager"!
309
	 *
310
	 * @param string Last part of the class name
311
	 * @since 2015.10
312
	 */
313
314
	/** mshop/supplier/manager/decorators/excludes
315
	 * Excludes decorators added by the "common" option from the supplier manager
316
	 *
317
	 * Decorators extend the functionality of a class by adding new aspects
318
	 * (e.g. log what is currently done), executing the methods of the underlying
319
	 * class only in certain conditions (e.g. only for logged in users) or
320
	 * modify what is returned to the caller.
321
	 *
322
	 * This option allows you to remove a decorator added via
323
	 * "mshop/common/manager/decorators/default" before they are wrapped
324
	 * around the supplier manager.
325
	 *
326
	 *  mshop/supplier/manager/decorators/excludes = array( 'decorator1' )
327
	 *
328
	 * This would remove the decorator named "decorator1" from the list of
329
	 * common decorators ("\Aimeos\MShop\Common\Manager\Decorator\*") added via
330
	 * "mshop/common/manager/decorators/default" for the supplier manager.
331
	 *
332
	 * @param array List of decorator names
333
	 * @since 2015.10
334
	 * @see mshop/common/manager/decorators/default
335
	 * @see mshop/supplier/manager/decorators/global
336
	 * @see mshop/supplier/manager/decorators/local
337
	 */
338
339
	/** mshop/supplier/manager/decorators/global
340
	 * Adds a list of globally available decorators only to the supplier manager
341
	 *
342
	 * Decorators extend the functionality of a class by adding new aspects
343
	 * (e.g. log what is currently done), executing the methods of the underlying
344
	 * class only in certain conditions (e.g. only for logged in users) or
345
	 * modify what is returned to the caller.
346
	 *
347
	 * This option allows you to wrap global decorators
348
	 * ("\Aimeos\MShop\Common\Manager\Decorator\*") around the supplier manager.
349
	 *
350
	 *  mshop/supplier/manager/decorators/global = array( 'decorator1' )
351
	 *
352
	 * This would add the decorator named "decorator1" defined by
353
	 * "\Aimeos\MShop\Common\Manager\Decorator\Decorator1" only to the supplier
354
	 * manager.
355
	 *
356
	 * @param array List of decorator names
357
	 * @since 2015.10
358
	 * @see mshop/common/manager/decorators/default
359
	 * @see mshop/supplier/manager/decorators/excludes
360
	 * @see mshop/supplier/manager/decorators/local
361
	 */
362
363
	/** mshop/supplier/manager/decorators/local
364
	 * Adds a list of local decorators only to the supplier manager
365
	 *
366
	 * Decorators extend the functionality of a class by adding new aspects
367
	 * (e.g. log what is currently done), executing the methods of the underlying
368
	 * class only in certain conditions (e.g. only for logged in users) or
369
	 * modify what is returned to the caller.
370
	 *
371
	 * This option allows you to wrap local decorators
372
	 * ("\Aimeos\MShop\Supplier\Manager\Decorator\*") around the supplier manager.
373
	 *
374
	 *  mshop/supplier/manager/decorators/local = array( 'decorator2' )
375
	 *
376
	 * This would add the decorator named "decorator2" defined by
377
	 * "\Aimeos\MShop\Supplier\Manager\Decorator\Decorator2" only to the supplier
378
	 * manager.
379
	 *
380
	 * @param array List of decorator names
381
	 * @since 2015.10
382
	 * @see mshop/common/manager/decorators/default
383
	 * @see mshop/supplier/manager/decorators/excludes
384
	 * @see mshop/supplier/manager/decorators/global
385
	 */
386
387
	/** mshop/supplier/manager/submanagers
388
	 * List of manager names that can be instantiated by the supplier manager
389
	 *
390
	 * Managers provide a generic interface to the underlying storage.
391
	 * Each manager has or can have sub-managers caring about particular
392
	 * aspects. Each of these sub-managers can be instantiated by its
393
	 * parent manager using the getSubManager() method.
394
	 *
395
	 * The search keys from sub-managers can be normally used in the
396
	 * manager as well. It allows you to search for items of the manager
397
	 * using the search keys of the sub-managers to further limit the
398
	 * retrieved list of items.
399
	 *
400
	 * @param array List of sub-manager names
401
	 * @since 2015.10
402
	 */
403
404
	/** mshop/supplier/manager/delete/mysql
405
	 * Deletes the items matched by the given IDs from the database
406
	 *
407
	 * @see mshop/supplier/manager/delete/ansi
408
	 */
409
410
	/** mshop/supplier/manager/delete/ansi
411
	 * Deletes the items matched by the given IDs from the database
412
	 *
413
	 * Removes the records specified by the given IDs from the supplier database.
414
	 * The records must be from the site that is configured via the
415
	 * context item.
416
	 *
417
	 * The ":cond" placeholder is replaced by the name of the ID column and
418
	 * the given ID or list of IDs while the site ID is bound to the question
419
	 * mark.
420
	 *
421
	 * The SQL statement should conform to the ANSI standard to be
422
	 * compatible with most relational database systems. This also
423
	 * includes using double quotes for table and column names.
424
	 *
425
	 * @param string SQL statement for deleting items
426
	 * @since 2015.10
427
	 * @see mshop/supplier/manager/insert/ansi
428
	 * @see mshop/supplier/manager/update/ansi
429
	 * @see mshop/supplier/manager/newid/ansi
430
	 * @see mshop/supplier/manager/search/ansi
431
	 * @see mshop/supplier/manager/count/ansi
432
	 */
433
434
	/** mshop/supplier/manager/insert/mysql
435
	 * Inserts a new supplier record into the database table
436
	 *
437
	 * @see mshop/supplier/manager/insert/ansi
438
	 */
439
440
	/** mshop/supplier/manager/insert/ansi
441
	 * Inserts a new supplier record into the database table
442
	 *
443
	 * Items with no ID yet (i.e. the ID is NULL) will be created in
444
	 * the database and the newly created ID retrieved afterwards
445
	 * using the "newid" SQL statement.
446
	 *
447
	 * The SQL statement must be a string suitable for being used as
448
	 * prepared statement. It must include question marks for binding
449
	 * the values from the supplier item to the statement before they are
450
	 * sent to the database server. The number of question marks must
451
	 * be the same as the number of columns listed in the INSERT
452
	 * statement. The order of the columns must correspond to the
453
	 * order in the save() method, so the correct values are
454
	 * bound to the columns.
455
	 *
456
	 * The SQL statement should conform to the ANSI standard to be
457
	 * compatible with most relational database systems. This also
458
	 * includes using double quotes for table and column names.
459
	 *
460
	 * @param string SQL statement for inserting records
461
	 * @since 2015.10
462
	 * @see mshop/supplier/manager/update/ansi
463
	 * @see mshop/supplier/manager/newid/ansi
464
	 * @see mshop/supplier/manager/delete/ansi
465
	 * @see mshop/supplier/manager/search/ansi
466
	 * @see mshop/supplier/manager/count/ansi
467
	 */
468
469
	/** mshop/supplier/manager/update/mysql
470
	 * Updates an existing supplier record in the database
471
	 *
472
	 * @see mshop/supplier/manager/update/ansi
473
	 */
474
475
	/** mshop/supplier/manager/update/ansi
476
	 * Updates an existing supplier record in the database
477
	 *
478
	 * Items which already have an ID (i.e. the ID is not NULL) will
479
	 * be updated in the database.
480
	 *
481
	 * The SQL statement must be a string suitable for being used as
482
	 * prepared statement. It must include question marks for binding
483
	 * the values from the supplier item to the statement before they are
484
	 * sent to the database server. The order of the columns must
485
	 * correspond to the order in the save() method, so the
486
	 * correct values are bound to the columns.
487
	 *
488
	 * The SQL statement should conform to the ANSI standard to be
489
	 * compatible with most relational database systems. This also
490
	 * includes using double quotes for table and column names.
491
	 *
492
	 * @param string SQL statement for updating records
493
	 * @since 2015.10
494
	 * @see mshop/supplier/manager/insert/ansi
495
	 * @see mshop/supplier/manager/newid/ansi
496
	 * @see mshop/supplier/manager/delete/ansi
497
	 * @see mshop/supplier/manager/search/ansi
498
	 * @see mshop/supplier/manager/count/ansi
499
	 */
500
501
	/** mshop/supplier/manager/newid/mysql
502
	 * Retrieves the ID generated by the database when inserting a new record
503
	 *
504
	 * @see mshop/supplier/manager/newid/ansi
505
	 */
506
507
	/** mshop/supplier/manager/newid/ansi
508
	 * Retrieves the ID generated by the database when inserting a new record
509
	 *
510
	 * As soon as a new record is inserted into the database table,
511
	 * the database server generates a new and unique identifier for
512
	 * that record. This ID can be used for retrieving, updating and
513
	 * deleting that specific record from the table again.
514
	 *
515
	 * For MySQL:
516
	 *  SELECT LAST_INSERT_ID()
517
	 * For PostgreSQL:
518
	 *  SELECT currval('seq_msup_id')
519
	 * For SQL Server:
520
	 *  SELECT SCOPE_IDENTITY()
521
	 * For Oracle:
522
	 *  SELECT "seq_msup_id".CURRVAL FROM DUAL
523
	 *
524
	 * There's no way to retrive the new ID by a SQL statements that
525
	 * fits for most database servers as they implement their own
526
	 * specific way.
527
	 *
528
	 * @param string SQL statement for retrieving the last inserted record ID
529
	 * @since 2015.10
530
	 * @see mshop/supplier/manager/insert/ansi
531
	 * @see mshop/supplier/manager/update/ansi
532
	 * @see mshop/supplier/manager/delete/ansi
533
	 * @see mshop/supplier/manager/search/ansi
534
	 * @see mshop/supplier/manager/count/ansi
535
	 */
536
537
	/** mshop/supplier/manager/sitemode
538
	 * Mode how items from levels below or above in the site tree are handled
539
	 *
540
	 * By default, only items from the current site are fetched from the
541
	 * storage. If the ai-sites extension is installed, you can create a
542
	 * tree of sites. Then, this setting allows you to define for the
543
	 * whole supplier domain if items from parent sites are inherited,
544
	 * sites from child sites are aggregated or both.
545
	 *
546
	 * Available constants for the site mode are:
547
	 * * 0 = only items from the current site
548
	 * * 1 = inherit items from parent sites
549
	 * * 2 = aggregate items from child sites
550
	 * * 3 = inherit and aggregate items at the same time
551
	 *
552
	 * You also need to set the mode in the locale manager
553
	 * (mshop/locale/manager/sitelevel) to one of the constants.
554
	 * If you set it to the same value, it will work as described but you
555
	 * can also use different modes. For example, if inheritance and
556
	 * aggregation is configured the locale manager but only inheritance
557
	 * in the domain manager because aggregating items makes no sense in
558
	 * this domain, then items wil be only inherited. Thus, you have full
559
	 * control over inheritance and aggregation in each domain.
560
	 *
561
	 * @param int Constant from Aimeos\MShop\Locale\Manager\Base class
562
	 * @since 2018.01
563
	 * @see mshop/locale/manager/sitelevel
564
	 */
565
566
	/** mshop/supplier/manager/search/mysql
567
	 * Retrieves the records matched by the given criteria in the database
568
	 *
569
	 * @see mshop/supplier/manager/search/ansi
570
	 */
571
572
	/** mshop/supplier/manager/search/ansi
573
	 * Retrieves the records matched by the given criteria in the database
574
	 *
575
	 * Fetches the records matched by the given criteria from the supplier
576
	 * database. The records must be from one of the sites that are
577
	 * configured via the context item. If the current site is part of
578
	 * a tree of sites, the SELECT statement can retrieve all records
579
	 * from the current site and the complete sub-tree of sites.
580
	 *
581
	 * As the records can normally be limited by criteria from sub-managers,
582
	 * their tables must be joined in the SQL context. This is done by
583
	 * using the "internaldeps" property from the definition of the ID
584
	 * column of the sub-managers. These internal dependencies specify
585
	 * the JOIN between the tables and the used columns for joining. The
586
	 * ":joins" placeholder is then replaced by the JOIN strings from
587
	 * the sub-managers.
588
	 *
589
	 * To limit the records matched, conditions can be added to the given
590
	 * criteria object. It can contain comparisons like column names that
591
	 * must match specific values which can be combined by AND, OR or NOT
592
	 * operators. The resulting string of SQL conditions replaces the
593
	 * ":cond" placeholder before the statement is sent to the database
594
	 * server.
595
	 *
596
	 * If the records that are retrieved should be ordered by one or more
597
	 * columns, the generated string of column / sort direction pairs
598
	 * replaces the ":order" placeholder. Columns of
599
	 * sub-managers can also be used for ordering the result set but then
600
	 * no index can be used.
601
	 *
602
	 * The number of returned records can be limited and can start at any
603
	 * number between the begining and the end of the result set. For that
604
	 * the ":size" and ":start" placeholders are replaced by the
605
	 * corresponding values from the criteria object. The default values
606
	 * are 0 for the start and 100 for the size value.
607
	 *
608
	 * The SQL statement should conform to the ANSI standard to be
609
	 * compatible with most relational database systems. This also
610
	 * includes using double quotes for table and column names.
611
	 *
612
	 * @param string SQL statement for searching items
613
	 * @since 2015.10
614
	 * @see mshop/supplier/manager/insert/ansi
615
	 * @see mshop/supplier/manager/update/ansi
616
	 * @see mshop/supplier/manager/newid/ansi
617
	 * @see mshop/supplier/manager/delete/ansi
618
	 * @see mshop/supplier/manager/count/ansi
619
	 */
620
621
	/** mshop/supplier/manager/count/mysql
622
	 * Counts the number of records matched by the given criteria in the database
623
	 *
624
	 * @see mshop/supplier/manager/count/ansi
625
	 */
626
627
	/** mshop/supplier/manager/count/ansi
628
	 * Counts the number of records matched by the given criteria in the database
629
	 *
630
	 * Counts all records matched by the given criteria from the supplier
631
	 * database. The records must be from one of the sites that are
632
	 * configured via the context item. If the current site is part of
633
	 * a tree of sites, the statement can count all records from the
634
	 * current site and the complete sub-tree of sites.
635
	 *
636
	 * As the records can normally be limited by criteria from sub-managers,
637
	 * their tables must be joined in the SQL context. This is done by
638
	 * using the "internaldeps" property from the definition of the ID
639
	 * column of the sub-managers. These internal dependencies specify
640
	 * the JOIN between the tables and the used columns for joining. The
641
	 * ":joins" placeholder is then replaced by the JOIN strings from
642
	 * the sub-managers.
643
	 *
644
	 * To limit the records matched, conditions can be added to the given
645
	 * criteria object. It can contain comparisons like column names that
646
	 * must match specific values which can be combined by AND, OR or NOT
647
	 * operators. The resulting string of SQL conditions replaces the
648
	 * ":cond" placeholder before the statement is sent to the database
649
	 * server.
650
	 *
651
	 * Both, the strings for ":joins" and for ":cond" are the same as for
652
	 * the "search" SQL statement.
653
	 *
654
	 * Contrary to the "search" statement, it doesn't return any records
655
	 * but instead the number of records that have been found. As counting
656
	 * thousands of records can be a long running task, the maximum number
657
	 * of counted records is limited for performance reasons.
658
	 *
659
	 * The SQL statement should conform to the ANSI standard to be
660
	 * compatible with most relational database systems. This also
661
	 * includes using double quotes for table and column names.
662
	 *
663
	 * @param string SQL statement for counting items
664
	 * @since 2015.10
665
	 * @see mshop/supplier/manager/insert/ansi
666
	 * @see mshop/supplier/manager/update/ansi
667
	 * @see mshop/supplier/manager/newid/ansi
668
	 * @see mshop/supplier/manager/delete/ansi
669
	 * @see mshop/supplier/manager/search/ansi
670
	 */
671
}
672