Passed
Push — master ( 8a4484...3ac2eb )
by Aimeos
04:39
created

Standard::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 10
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 Metaways Infosystems GmbH, 2011
6
 * @copyright Aimeos (aimeos.org), 2015-2024
7
 * @package MShop
8
 * @subpackage Price
9
 */
10
11
12
namespace Aimeos\MShop\Price\Manager;
13
14
15
/**
16
 * Default implementation of a price manager.
17
 *
18
 * @package MShop
19
 * @subpackage Price
20
 */
21
class Standard
22
	extends \Aimeos\MShop\Price\Manager\Base
23
	implements \Aimeos\MShop\Price\Manager\Iface, \Aimeos\MShop\Common\Manager\Factory\Iface
24
{
25
	use \Aimeos\MShop\Common\Manager\ListsRef\Traits;
26
	use \Aimeos\MShop\Common\Manager\PropertyRef\Traits;
27
28
29
	private bool $taxflag;
30
	private int $precision;
31
32
33
	/**
34
	 * Creates the price manager that will use the given context object.
35
	 *
36
	 * @param \Aimeos\MShop\ContextIface $context Context object with required objects
37
	 */
38
	public function __construct( \Aimeos\MShop\ContextIface $context )
39
	{
40
		parent::__construct( $context );
41
42
		$config = $context->config();
43
44
		/** mshop/price/taxflag
45
		 * Configuration setting if prices are inclusive or exclusive tax
46
		 *
47
		 * In Aimeos, prices can be entered either completely with or without tax. The
48
		 * default is that prices contains tax. You must specifiy the tax rate for each
49
		 * prices to prevent wrong calculations.
50
		 *
51
		 * @param bool True if gross prices are used, false for net prices
52
		 * @since 2016.02
53
		 */
54
		$this->taxflag = (bool) $config->get( 'mshop/price/taxflag', true );
55
56
		/** mshop/price/precision
57
		 * Number of decimal digits prices contain
58
		 *
59
		 * Sets the number of decimal digits price values will contain. Internally,
60
		 * prices are calculated as double values with high precision but these
61
		 * values will be rounded after calculation to the configured number of digits.
62
		 *
63
		 * @param int Positive number of digits
64
		 * @since 2019.04
65
		 */
66
		$this->precision = (int) $config->get( 'mshop/price/precision', 2 );
67
	}
68
69
70
	/**
71
	 * Creates a new empty item instance
72
	 *
73
	 * @param array $values Values the item should be initialized with
74
	 * @return \Aimeos\MShop\Price\Item\Iface New price item object
75
	 */
76
	public function create( array $values = [] ) : \Aimeos\MShop\Common\Item\Iface
77
	{
78
		$locale = $this->context()->locale();
79
80
		$values['price.taxflag'] = $values['price.taxflag'] ?? $this->taxflag;
81
		$values['price.precision'] = $values['price.precision'] ?? $this->precision;
82
		$values['price.currencyid'] = $values['price.currencyid'] ?? $locale->getCurrencyId();
83
		$values['price.siteid'] = $values['price.siteid'] ?? $locale->getSiteId();
84
85
		return new \Aimeos\MShop\Price\Item\Standard( 'price.', $values );
86
	}
87
88
89
	/**
90
	 * Removes multiple items.
91
	 *
92
	 * @param \Aimeos\MShop\Common\Item\Iface[]|string[] $items List of item objects or IDs of the items
93
	 * @return \Aimeos\MShop\Price\Manager\Iface Manager object for chaining method calls
94
	 */
95
	public function delete( $items ) : \Aimeos\MShop\Common\Manager\Iface
96
	{
97
		return parent::delete( $items )->deleteRefItems( $items );
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
			'price.type' => [
110
				'label' => 'Price type ID',
111
				'internalcode' => 'type',
112
			],
113
			'price.currencyid' => [
114
				'label' => 'Price currency code',
115
				'internalcode' => 'currencyid',
116
			],
117
			'price.domain' => [
118
				'label' => 'Price domain',
119
				'internalcode' => 'domain',
120
			],
121
			'price.label' => [
122
				'label' => 'Price label',
123
				'internalcode' => 'label',
124
			],
125
			'price.quantity' => [
126
				'label' => 'Price quantity',
127
				'internalcode' => 'quantity',
128
				'type' => 'float',
129
			],
130
			'price.value' => [
131
				'label' => 'Price regular value',
132
				'internalcode' => 'value',
133
				'type' => 'decimal',
134
			],
135
			'price.costs' => [
136
				'label' => 'Price shipping costs',
137
				'internalcode' => 'costs',
138
				'type' => 'decimal',
139
			],
140
			'price.rebate' => [
141
				'label' => 'Price rebate amount',
142
				'internalcode' => 'rebate',
143
				'type' => 'decimal',
144
			],
145
			'price.taxrate' => [
146
				'label' => 'Price tax rates as JSON encoded string',
147
				'internalcode' => 'taxrate',
148
				'type' => 'json',
149
			],
150
			'price.taxrates' => [
151
				'label' => 'Price tax rates as JSON encoded string',
152
				'internalcode' => 'taxrate',
153
				'type' => 'json',
154
			],
155
			'price.status' => [
156
				'label' => 'Price status',
157
				'internalcode' => 'status',
158
				'type' => 'int',
159
			],
160
		] );
161
	}
162
163
164
	/**
165
	 * Returns the attributes that can be used for searching.
166
	 *
167
	 * @param bool $withsub Return also attributes of sub-managers if true
168
	 * @return \Aimeos\Base\Criteria\Attribute\Iface[] List of search attribute items
169
	 */
170
	public function getSearchAttributes( bool $withsub = true ) : array
171
	{
172
		$level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL;
173
		$level = $this->context()->config()->get( 'mshop/price/manager/sitemode', $level );
174
175
		return array_replace( parent::getSearchAttributes( $withsub ), $this->createAttributes( [
176
			'price:has' => array(
177
				'code' => 'price:has()',
178
				'internalcode' => ':site AND :key AND mprili."id"',
179
				'internaldeps' => ['LEFT JOIN "mshop_price_list" AS mprili ON ( mprili."parentid" = mpri."id" )'],
180
				'label' => 'Price has list item, parameter(<domain>[,<list type>[,<reference ID>)]]',
181
				'type' => 'null',
182
				'public' => false,
183
				'function' => function( &$source, array $params ) use ( $level ) {
184
					$keys = [];
185
186
					foreach( (array) ( $params[1] ?? '' ) as $type ) {
187
						foreach( (array) ( $params[2] ?? '' ) as $id ) {
188
							$keys[] = $params[0] . '|' . ( $type ? $type . '|' : '' ) . $id;
189
						}
190
					}
191
192
					$sitestr = $this->siteString( 'mprili."siteid"', $level );
193
					$keystr = $this->toExpression( 'mprili."key"', $keys, ( $params[2] ?? null ) ? '==' : '=~' );
194
					$source = str_replace( [':site', ':key'], [$sitestr, $keystr], $source );
195
196
					return $params;
197
				}
198
			),
199
			'price:prop' => array(
200
				'code' => 'price:prop()',
201
				'internalcode' => ':site AND :key AND mpripr."id"',
202
				'internaldeps' => ['LEFT JOIN "mshop_price_property" AS mpripr ON ( mpripr."parentid" = mpri."id" )'],
203
				'label' => 'Price has property item, parameter(<property type>[,<language code>[,<property value>]])',
204
				'type' => 'null',
205
				'public' => false,
206
				'function' => function( &$source, array $params ) use ( $level ) {
207
					$keys = [];
208
					$langs = array_key_exists( 1, $params ) ? ( $params[1] ?? 'null' ) : '';
209
210
					foreach( (array) $langs as $lang ) {
211
						foreach( (array) ( $params[2] ?? '' ) as $val ) {
212
							$keys[] = substr( $params[0] . '|' . ( $lang === null ? 'null|' : ( $lang ? $lang . '|' : '' ) ) . $val, 0, 255 );
213
						}
214
					}
215
216
					$sitestr = $this->siteString( 'mpripr."siteid"', $level );
217
					$keystr = $this->toExpression( 'mpripr."key"', $keys, ( $params[2] ?? null ) ? '==' : '=~' );
218
					$source = str_replace( [':site', ':key'], [$sitestr, $keystr], $source );
219
220
					return $params;
221
				}
222
			),
223
		] ) );
224
	}
225
226
227
	/**
228
	 * Creates a filter object.
229
	 *
230
	 * @param bool|null $default Add default criteria or NULL for relaxed default criteria
231
	 * @param bool $site TRUE for adding site criteria to limit items by the site of related items
232
	 * @return \Aimeos\Base\Criteria\Iface Returns the filter object
233
	 */
234
	public function filter( ?bool $default = false, bool $site = false ) : \Aimeos\Base\Criteria\Iface
235
	{
236
		$filter = $this->filterBase( 'price', $default );
237
238
		if( $default !== false && ( $currencyid = $this->context()->locale()->getCurrencyId() ) !== null ) {
239
			$filter->add( 'price.currencyid', '==', $currencyid );
240
		}
241
242
		return $filter;
243
	}
244
245
246
	/**
247
	 * Fetches the rows from the database statement and returns the list of items.
248
	 *
249
	 * @param \Aimeos\Base\DB\Result\Iface $stmt Database statement object
250
	 * @param array $ref List of domains whose items should be fetched too
251
	 * @param string $prefix Prefix for the property names
252
	 * @param array $attrs List of attributes that should be decoded
253
	 * @return \Aimeos\Map List of items implementing \Aimeos\MShop\Common\Item\Iface
254
	 */
255
	protected function fetch( \Aimeos\Base\DB\Result\Iface $results, array $ref, string $prefix = '', array $attrs = [] ) : \Aimeos\Map
256
	{
257
		$map = $items = $parentIds = $propItems = [];
258
259
		while( $row = $results->fetch() )
260
		{
261
			foreach( $attrs as $code => $attr ) {
262
				$row[$code] = json_decode( $row[$code], true );
263
			}
264
265
			$map[$row['price.id']] = $row;
266
			$parentIds[] = $row['price.id'];
267
		}
268
269
		if( $this->hasRef( $ref, 'price/property' ) )
270
		{
271
			$name = 'price/property';
272
			$propTypes = isset( $ref[$name] ) && is_array( $ref[$name] ) ? $ref[$name] : null;
273
274
			$propItems = $this->getPropertyItems( $parentIds, 'price', $propTypes );
275
		}
276
277
		$listItems = map( $this->getListItems( $parentIds, $ref, 'price' ) )->groupBy( 'price.lists.parentid' );
278
279
		foreach( $map as $id => $row )
280
		{
281
			$row['.listitems'] = $listItems[$id] ?? [];
282
			$row['.propitems'] = $propItems[$id] ?? [];
283
284
			if( $item = $this->applyFilter( $this->create( $row ) ) ) {
285
				$items[$id] = $item;
286
			}
287
		}
288
289
		return map( $items );
290
	}
291
292
293
	/**
294
	 * Returns the prefix for the item properties and search keys.
295
	 *
296
	 * @return string Prefix for the item properties and search keys
297
	 */
298
	protected function prefix() : string
299
	{
300
		return 'price.';
301
	}
302
303
304
	/**
305
	 * Saves the dependent items of the item
306
	 *
307
	 * @param \Aimeos\MShop\Common\Item\Iface $item Item object
308
	 * @param bool $fetch True if the new ID should be returned in the item
309
	 * @return \Aimeos\MShop\Common\Item\Iface Updated item
310
	 */
311
	protected function saveDeps( \Aimeos\MShop\Common\Item\Iface $item, bool $fetch = true ) : \Aimeos\MShop\Common\Item\Iface
312
	{
313
		$item = $this->savePropertyItems( $item, 'price', $fetch );
314
		return $this->saveListItems( $item, 'price', $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\Price\Manag...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

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