Passed
Push — master ( 0f8255...e2f38b )
by Aimeos
04:26
created

Standard::delete()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 34
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 34
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
/**
4
 * @license LGPLv3, https://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2015-2024
6
 * @package MShop
7
 * @subpackage Attribute
8
 */
9
10
11
namespace Aimeos\MShop\Attribute\Manager;
12
13
14
/**
15
 * Default attribute manager for creating and handling attributes.
16
 *
17
 * @package MShop
18
 * @subpackage Attribute
19
 */
20
class Standard
21
	extends \Aimeos\MShop\Common\Manager\Base
22
	implements \Aimeos\MShop\Attribute\Manager\Iface, \Aimeos\MShop\Common\Manager\Factory\Iface
23
{
24
	use \Aimeos\MShop\Common\Manager\ListsRef\Traits;
25
	use \Aimeos\MShop\Common\Manager\PropertyRef\Traits;
26
27
28
	/**
29
	 * Creates a new empty item instance
30
	 *
31
	 * @param array $values Values the item should be initialized with
32
	 * @return \Aimeos\MShop\Attribute\Item\Iface New attribute item object
33
	 */
34
	public function create( array $values = [] ) : \Aimeos\MShop\Common\Item\Iface
35
	{
36
		$values['attribute.siteid'] = $values['attribute.siteid'] ?? $this->context()->locale()->getSiteId();
37
		return new \Aimeos\MShop\Attribute\Item\Standard( 'attribute.', $values );
38
	}
39
40
41
	/**
42
	 * Creates a filter object.
43
	 *
44
	 * @param bool|null $default Add default criteria or NULL for relaxed default criteria
45
	 * @param bool $site TRUE for adding site criteria to limit items by the site of related items
46
	 * @return \Aimeos\Base\Criteria\Iface Returns the filter object
47
	 */
48
	public function filter( ?bool $default = false, bool $site = false ) : \Aimeos\Base\Criteria\Iface
49
	{
50
		return $this->filterBase( 'attribute', $default );
51
	}
52
53
54
	/**
55
	 * Returns the item specified by its code and domain/type if necessary
56
	 *
57
	 * @param string $code Code of the item
58
	 * @param string[] $ref List of domains to fetch list items and referenced items for
59
	 * @param string|null $domain Domain of the item if necessary to identify the item uniquely
60
	 * @param string|null $type Type code of the item if necessary to identify the item uniquely
61
	 * @param bool|null $default Add default criteria or NULL for relaxed default criteria
62
	 * @return \Aimeos\MShop\Attribute\Item\Iface Attribute item object
63
	 */
64
	public function find( string $code, array $ref = [], ?string $domain = 'product', string $type = null,
65
		?bool $default = false ) : \Aimeos\MShop\Common\Item\Iface
66
	{
67
		$find = [
68
			'attribute.code' => $code,
69
			'attribute.domain' => $domain,
70
			'attribute.type' => $type,
71
		];
72
		return $this->findBase( $find, $ref, $default );
73
	}
74
75
76
	/**
77
	 * Returns the additional column/search definitions
78
	 *
79
	 * @return array Associative list of column names as keys and items implementing \Aimeos\Base\Criteria\Attribute\Iface
80
	 */
81
	public function getSaveAttributes() : array
82
	{
83
		return $this->createAttributes( [
84
			'attribute.key' => [
85
				'label' => 'Unique key',
86
				'internalcode' => 'key',
87
				'public' => false,
88
			],
89
			'attribute.type' => [
90
				'label' => 'Type',
91
				'internalcode' => 'type',
92
			],
93
			'attribute.label' => [
94
				'label' => 'Label',
95
				'internalcode' => 'label',
96
			],
97
			'attribute.code' => [
98
				'label' => 'Code',
99
				'internalcode' => 'code',
100
			],
101
			'attribute.domain' => [
102
				'label' => 'Domain',
103
				'internalcode' => 'domain',
104
			],
105
			'attribute.position' => [
106
				'label' => 'Position',
107
				'internalcode' => 'pos',
108
				'type' => 'int',
109
			],
110
			'attribute.status' => [
111
				'label' => 'Status',
112
				'internalcode' => 'status',
113
				'type' => 'int',
114
			],
115
		] );
116
	}
117
118
119
	/**
120
	 * Returns the attributes that can be used for searching.
121
	 *
122
	 * @param bool $withsub Return also attributes of sub-managers if true
123
	 * @return \Aimeos\Base\Criteria\Attribute\Iface[] List of search attribute items
124
	 */
125
	public function getSearchAttributes( bool $withsub = true ) : array
126
	{
127
		$level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL;
128
		$level = $this->context()->config()->get( 'mshop/attribute/manager/sitemode', $level );
129
130
		return array_replace( parent::getSearchAttributes( $withsub ), $this->createAttributes( [
131
			'attribute:has' => array(
132
				'code' => 'attribute:has()',
133
				'internalcode' => ':site AND :key AND mattli."id"',
134
				'internaldeps' => ['LEFT JOIN "mshop_attribute_list" AS mattli ON ( mattli."parentid" = matt."id" )'],
135
				'label' => 'Attribute has list item, parameter(<domain>[,<list type>[,<reference ID>)]]',
136
				'type' => 'null',
137
				'public' => false,
138
				'function' => function( &$source, array $params ) use ( $level ) {
139
					$keys = [];
140
141
					foreach( (array) ( $params[1] ?? '' ) as $type ) {
142
						foreach( (array) ( $params[2] ?? '' ) as $id ) {
143
							$keys[] = substr( $params[0] . '|' . ( $type ? $type . '|' : '' ) . $id, 0, 255 );
144
						}
145
					}
146
147
					$sitestr = $this->siteString( 'mattli."siteid"', $level );
148
					$keystr = $this->toExpression( 'mattli."key"', $keys, ( $params[2] ?? null ) ? '==' : '=~' );
149
					$source = str_replace( [':site', ':key'], [$sitestr, $keystr], $source );
150
151
					return $params;
152
				}
153
			),
154
			'attribute:prop' => array(
155
				'code' => 'attribute:prop()',
156
				'internalcode' => ':site AND :key AND mattpr."id"',
157
				'internaldeps' => ['LEFT JOIN "mshop_attribute_property" AS mattpr ON ( mattpr."parentid" = matt."id" )'],
158
				'label' => 'Attribute has property item, parameter(<property type>[,<language code>[,<property value>]])',
159
				'type' => 'null',
160
				'public' => false,
161
				'function' => function( &$source, array $params ) use ( $level ) {
162
					$keys = [];
163
					$langs = array_key_exists( 1, $params ) ? ( $params[1] ?? 'null' ) : '';
164
165
					foreach( (array) $langs as $lang ) {
166
						foreach( (array) ( $params[2] ?? '' ) as $val ) {
167
							$keys[] = substr( $params[0] . '|' . ( $lang === null ? 'null|' : ( $lang ? $lang . '|' : '' ) ) . $val, 0, 255 );
168
						}
169
					}
170
171
					$sitestr = $this->siteString( 'mattpr."siteid"', $level );
172
					$keystr = $this->toExpression( 'mattpr."key"', $keys, ( $params[2] ?? null ) ? '==' : '=~' );
173
					$source = str_replace( [':site', ':key'], [$sitestr, $keystr], $source );
174
175
					return $params;
176
				}
177
			),
178
		] ) );
179
	}
180
181
182
	/**
183
	 * Fetches the rows from the database statement and returns the list of items.
184
	 *
185
	 * @param \Aimeos\Base\DB\Result\Iface $stmt Database statement object
186
	 * @param array $ref List of domains whose items should be fetched too
187
	 * @param string $prefix Prefix for the property names
188
	 * @param array $attrs List of attributes that should be decoded
189
	 * @return \Aimeos\Map List of items implementing \Aimeos\MShop\Common\Item\Iface
190
	 */
191
	protected function fetch( \Aimeos\Base\DB\Result\Iface $results, array $ref, string $prefix = '', array $attrs = [] ) : \Aimeos\Map
192
	{
193
		$map = $items = $parentIds = $propItems = [];
194
195
		while( $row = $results->fetch() )
196
		{
197
			$map[$row['attribute.id']] = $row;
198
			$parentIds[] = $row['attribute.id'];
199
		}
200
201
		if( $this->hasRef( $ref, 'attribute/property' ) )
202
		{
203
			$name = 'attribute/property';
204
			$propTypes = isset( $ref[$name] ) && is_array( $ref[$name] ) ? $ref[$name] : null;
205
206
			$propItems = $this->getPropertyItems( $parentIds, 'attribute', $propTypes );
207
		}
208
209
		$listItems = map( $this->getListItems( $parentIds, $ref, 'attribute' ) )->groupBy( 'attribute.lists.parentid');
210
211
		foreach( $map as $id => $row )
212
		{
213
			$row['.listitems'] = $listItems[$id] ?? [];
214
			$row['.propitems'] = $propItems[$id] ?? [];
215
216
			if( $item = $this->applyFilter( $this->create( $row ) ) ) {
217
				$items[$id] = $item;
218
			}
219
		}
220
221
		return map( $items );
222
	}
223
224
225
	/**
226
	 * Returns the prefix for the item properties and search keys.
227
	 *
228
	 * @return string Prefix for the item properties and search keys
229
	 */
230
	protected function prefix() : string
231
	{
232
		return 'attribute.';
233
	}
234
235
236
	/**
237
	 * Saves the dependent items of the item
238
	 *
239
	 * @param \Aimeos\MShop\Common\Item\Iface $item Item object
240
	 * @param bool $fetch True if the new ID should be returned in the item
241
	 * @return \Aimeos\MShop\Common\Item\Iface Updated item
242
	 */
243
	protected function saveDeps( \Aimeos\MShop\Common\Item\Iface $item, bool $fetch = true ) : \Aimeos\MShop\Common\Item\Iface
244
	{
245
		$item = $this->savePropertyItems( $item, 'attribute', $fetch );
246
		return $this->saveListItems( $item, 'attribute', $fetch );
0 ignored issues
show
Bug introduced by
$item of type Aimeos\MShop\Common\Item\PropertyRef\Iface is incompatible with the type Aimeos\MShop\Common\Item\ListsRef\Iface expected by parameter $item of Aimeos\MShop\Attribute\M...andard::saveListItems(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

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