Passed
Push — master ( cbb785...7ebf0b )
by Aimeos
04:56
created

Standard::saveDeps()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 2
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 Customer
8
 */
9
10
11
namespace Aimeos\MShop\Customer\Manager;
12
13
14
/**
15
 * Default implementation of the customer class.
16
 *
17
 * @package MShop
18
 * @subpackage Customer
19
 */
20
class Standard
21
	extends \Aimeos\MShop\Customer\Manager\Base
22
	implements \Aimeos\MShop\Customer\Manager\Iface, \Aimeos\MShop\Common\Manager\Factory\Iface
23
{
24
	/**
25
	 * Removes old entries from the storage.
26
	 *
27
	 * @param iterable $siteids List of IDs for sites whose entries should be deleted
28
	 * @return \Aimeos\MShop\Customer\Manager\Iface Manager object for chaining method calls
29
	 */
30
	public function clear( iterable $siteids ) : \Aimeos\MShop\Common\Manager\Iface
31
	{
32
		foreach( $this->context()->config()->get( 'mshop/customer/manager/submanagers', [] ) as $domain ) {
33
			$this->object()->getSubManager( $domain )->clear( $siteids );
34
		}
35
36
		return $this->clearBase( $siteids, 'mshop/customer/manager/clear' );
37
	}
38
39
40
	/**
41
	 * Creates a new empty item instance
42
	 *
43
	 * @param array $values Values the item should be initialized with
44
	 * @return \Aimeos\MShop\Customer\Item\Iface New customer item object
45
	 */
46
	public function create( array $values = [] ) : \Aimeos\MShop\Common\Item\Iface
47
	{
48
		$values['customer.siteid'] = $values['customer.siteid'] ?? $this->context()->locale()->getSiteId();
49
50
		$address = new \Aimeos\MShop\Common\Item\Address\Standard( 'customer.', $values );
51
		return new \Aimeos\MShop\Customer\Item\Standard( $address, 'customer.', $values, $this->context()->password() );
52
	}
53
54
55
	/**
56
	 * Returns the attributes that can be used for searching.
57
	 *
58
	 * @param bool $withsub Return also attributes of sub-managers if true
59
	 * @return \Aimeos\Base\Criteria\Attribute\Iface List of search attribute items
60
	 */
61
	public function getSearchAttributes( bool $withsub = true ) : array
62
	{
63
		$level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL;
64
		$level = $this->context()->config()->get( 'mshop/customer/manager/sitemode', $level );
65
66
		return array_replace( parent::getSearchAttributes( $withsub ), $this->createAttributes( [
67
			'customer.id' => [
68
				'label' => 'ID',
69
				'internalcode' => 'id',
70
				'type' => 'int',
71
				'public' => false,
72
			],
73
			'customer.siteid' => [
74
				'label' => 'Customer site ID',
75
				'internalcode' => 'siteid',
76
				'public' => false,
77
			],
78
			'customer.code' => [
79
				'label' => 'Username',
80
				'internalcode' => 'code',
81
			],
82
			'customer.label' => [
83
				'label' => 'Label',
84
				'internalcode' => 'label',
85
			],
86
			'customer.salutation' => [
87
				'label' => 'Salutation',
88
				'internalcode' => 'salutation',
89
			],
90
			'customer.company' => [
91
				'label' => 'Company',
92
				'internalcode' => 'company',
93
			],
94
			'customer.vatid' => [
95
				'label' => 'Vat ID',
96
				'internalcode' => 'vatid',
97
			],
98
			'customer.title' => [
99
				'label' => 'Title',
100
				'internalcode' => 'title',
101
			],
102
			'customer.firstname' => [
103
				'label' => 'Firstname',
104
				'internalcode' => 'firstname',
105
			],
106
			'customer.lastname' => [
107
				'label' => 'Lastname',
108
				'internalcode' => 'lastname',
109
			],
110
			'customer.address1' => [
111
				'label' => 'Address part one',
112
				'internalcode' => 'address1',
113
			],
114
			'customer.address2' => [
115
				'label' => 'Address part two',
116
				'internalcode' => 'address2',
117
			],
118
			'customer.address3' => [
119
				'label' => 'Address part three',
120
				'internalcode' => 'address3',
121
			],
122
			'customer.postal' => [
123
				'label' => 'Postal',
124
				'internalcode' => 'postal',
125
			],
126
			'customer.city' => [
127
				'label' => 'City',
128
				'internalcode' => 'city',
129
			],
130
			'customer.state' => [
131
				'label' => 'State',
132
				'internalcode' => 'state',
133
			],
134
			'customer.languageid' => [
135
				'label' => 'Language',
136
				'internalcode' => 'langid',
137
			],
138
			'customer.countryid' => [
139
				'label' => 'Country',
140
				'internalcode' => 'countryid',
141
			],
142
			'customer.telephone' => [
143
				'label' => 'Telephone',
144
				'internalcode' => 'telephone',
145
			],
146
			'customer.telefax' => [
147
				'label' => 'Facsimile',
148
				'internalcode' => 'telefax',
149
			],
150
			'customer.mobile' => [
151
				'label' => 'Mobile number',
152
				'internalcode' => 'mobile',
153
			],
154
			'customer.email' => [
155
				'label' => 'E-mail',
156
				'internalcode' => 'email',
157
			],
158
			'customer.website' => [
159
				'label' => 'Web site',
160
				'internalcode' => 'website',
161
			],
162
			'customer.longitude' => [
163
				'label' => 'Longitude',
164
				'internalcode' => 'longitude',
165
				'public' => false,
166
			],
167
			'customer.latitude' => [
168
				'label' => 'Latitude',
169
				'internalcode' => 'latitude',
170
				'public' => false,
171
			],
172
			'customer.birthday' => [
173
				'label' => 'Birthday',
174
				'internalcode' => 'birthday',
175
			],
176
			'customer.status' => [
177
				'label' => 'Status',
178
				'internalcode' => 'status',
179
				'type' => 'int',
180
			],
181
			'customer.dateverified' => [
182
				'label' => 'Verification date',
183
				'internalcode' => 'vdate',
184
				'type' => 'date',
185
				'public' => false,
186
			],
187
			'customer.password' => [
188
				'label' => 'Password',
189
				'internalcode' => 'password',
190
				'public' => false,
191
			],
192
			'customer.ctime' => [
193
				'label' => 'Create date/time',
194
				'internalcode' => 'ctime',
195
				'type' => 'datetime',
196
				'public' => false,
197
			],
198
			'customer.mtime' => [
199
				'label' => 'Modify date/time',
200
				'internalcode' => 'mtime',
201
				'type' => 'datetime',
202
				'public' => false,
203
			],
204
			'customer.editor' => [
205
				'label' => 'Editor',
206
				'internalcode' => 'editor',
207
				'public' => false,
208
			],
209
			'customer:has' => [
210
				'code' => 'customer:has()',
211
				'internalcode' => ':site AND :key AND mcusli."id"',
212
				'internaldeps' => ['LEFT JOIN "mshop_customer_list" AS mcusli ON ( mcusli."parentid" = mcus."id" )'],
213
				'label' => 'Customer has list item, parameter(<domain>[,<list type>[,<reference ID>)]]',
214
				'type' => 'null',
215
				'public' => false,
216
				'function' => function( &$source, array $params ) use ( $level ) {
217
					$keys = [];
218
219
					foreach( (array) ( $params[1] ?? '' ) as $type ) {
220
						foreach( (array) ( $params[2] ?? '' ) as $id ) {
221
							$keys[] = $params[0] . '|' . ( $type ? $type . '|' : '' ) . $id;
222
						}
223
					}
224
225
					$sitestr = $this->siteString( 'mcusli."siteid"', $level );
226
					$keystr = $this->toExpression( 'mcusli."key"', $keys, ( $params[2] ?? null ) ? '==' : '=~' );
227
					$source = str_replace( [':site', ':key'], [$sitestr, $keystr], $source );
228
229
					return $params;
230
				}
231
			],
232
			'customer:prop' => [
233
				'code' => 'customer:prop()',
234
				'internalcode' => ':site AND :key AND mcuspr."id"',
235
				'internaldeps' => ['LEFT JOIN "mshop_customer_property" AS mcuspr ON ( mcuspr."parentid" = mcus."id" )'],
236
				'label' => 'Customer has property item, parameter(<property type>[,<language code>[,<property value>]])',
237
				'type' => 'null',
238
				'public' => false,
239
				'function' => function( &$source, array $params ) use ( $level ) {
240
					$keys = [];
241
					$langs = array_key_exists( 1, $params ) ? ( $params[1] ?? 'null' ) : '';
242
243
					foreach( (array) $langs as $lang ) {
244
						foreach( (array) ( $params[2] ?? '' ) as $val ) {
245
							$keys[] = substr( $params[0] . '|' . ( $lang === null ? 'null|' : ( $lang ? $lang . '|' : '' ) ) . $val, 0, 255 );
246
						}
247
					}
248
249
					$sitestr = $this->siteString( 'mcuspr."siteid"', $level );
250
					$keystr = $this->toExpression( 'mcuspr."key"', $keys, ( $params[2] ?? null ) ? '==' : '=~' );
251
					$source = str_replace( [':site', ':key'], [$sitestr, $keystr], $source );
252
253
					return $params;
254
				}
255
			],
256
		] ) );
257
	}
258
259
260
	/**
261
	 * Removes multiple items.
262
	 *
263
	 * @param \Aimeos\MShop\Common\Item\Iface[]|string[] $items List of item objects or IDs of the items
264
	 * @return \Aimeos\MShop\Customer\Manager\Iface Manager object for chaining method calls
265
	 */
266
	public function delete( $items ) : \Aimeos\MShop\Common\Manager\Iface
267
	{
268
		return $this->deleteItemsBase( $items, 'mshop/customer/manager/delete' )->deleteRefItems( $items );
269
	}
270
271
272
	/**
273
	 * Saves a customer item object.
274
	 *
275
	 * @param \Aimeos\MShop\Customer\Item\Iface $item Customer item object
276
	 * @param bool $fetch True if the new ID should be returned in the item
277
	 * @return \Aimeos\MShop\Customer\Item\Iface $item Updated item including the generated ID
278
	 */
279
	protected function saveItem( \Aimeos\MShop\Customer\Item\Iface $item, bool $fetch = true ) : \Aimeos\MShop\Customer\Item\Iface
280
	{
281
		$item = $this->addGroups( $item );
282
283
		if( !$item->isModified() ) {
284
			return $this->saveDeps( $item, $fetch );
285
		}
286
287
		$context = $this->context();
288
		$conn = $context->db( $this->getResourceName() );
289
290
		$id = $item->getId();
291
		$billingAddress = $item->getPaymentAddress();
292
		$columns = $this->object()->getSaveAttributes();
293
294
		if( $id === null )
295
		{
296
			/** mshop/customer/manager/insert/mysql
297
			 * Inserts a new customer record into the database table
298
			 *
299
			 * @see mshop/customer/manager/insert/ansi
300
			 */
301
302
			/** mshop/customer/manager/insert/ansi
303
			 * Inserts a new customer record into the database table
304
			 *
305
			 * Items with no ID yet (i.e. the ID is NULL) will be created in
306
			 * the database and the newly created ID retrieved afterwards
307
			 * using the "newid" SQL statement.
308
			 *
309
			 * The SQL statement must be a string suitable for being used as
310
			 * prepared statement. It must include question marks for binding
311
			 * the values from the customer item to the statement before they are
312
			 * sent to the database server. The number of question marks must
313
			 * be the same as the number of columns listed in the INSERT
314
			 * statement. The order of the columns must correspond to the
315
			 * order in the save() method, so the correct values are
316
			 * bound to the columns.
317
			 *
318
			 * The SQL statement should conform to the ANSI standard to be
319
			 * compatible with most relational database systems. This also
320
			 * includes using double quotes for table and column names.
321
			 *
322
			 * @param string SQL statement for inserting records
323
			 * @since 2015.10
324
			 * @see mshop/customer/manager/update/ansi
325
			 * @see mshop/customer/manager/newid/ansi
326
			 * @see mshop/customer/manager/delete/ansi
327
			 * @see mshop/customer/manager/search/ansi
328
			 * @see mshop/customer/manager/count/ansi
329
			 */
330
			$path = 'mshop/customer/manager/insert';
331
			$sql = $this->addSqlColumns( array_keys( $columns ), $this->getSqlConfig( $path ) );
0 ignored issues
show
Bug introduced by
It seems like $this->getSqlConfig($path) can also be of type array; however, parameter $sql of Aimeos\MShop\Common\Manager\Base::addSqlColumns() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

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

331
			$sql = $this->addSqlColumns( array_keys( $columns ), /** @scrutinizer ignore-type */ $this->getSqlConfig( $path ) );
Loading history...
332
		}
333
		else
334
		{
335
			/** mshop/customer/manager/update/mysql
336
			 * Updates an existing customer record in the database
337
			 *
338
			 * @see mshop/customer/manager/update/ansi
339
			 */
340
341
			/** mshop/customer/manager/update/ansi
342
			 * Updates an existing customer record in the database
343
			 *
344
			 * Items which already have an ID (i.e. the ID is not NULL) will
345
			 * be updated in the database.
346
			 *
347
			 * The SQL statement must be a string suitable for being used as
348
			 * prepared statement. It must include question marks for binding
349
			 * the values from the customer item to the statement before they are
350
			 * sent to the database server. The order of the columns must
351
			 * correspond to the order in the save() method, so the
352
			 * correct values are bound to the columns.
353
			 *
354
			 * The SQL statement should conform to the ANSI standard to be
355
			 * compatible with most relational database systems. This also
356
			 * includes using double quotes for table and column names.
357
			 *
358
			 * @param string SQL statement for updating records
359
			 * @since 2015.10
360
			 * @see mshop/customer/manager/insert/ansi
361
			 * @see mshop/customer/manager/newid/ansi
362
			 * @see mshop/customer/manager/delete/ansi
363
			 * @see mshop/customer/manager/search/ansi
364
			 * @see mshop/customer/manager/count/ansi
365
			 */
366
			$path = 'mshop/customer/manager/update';
367
			$sql = $this->addSqlColumns( array_keys( $columns ), $this->getSqlConfig( $path ), false );
368
		}
369
370
		$idx = 1;
371
		$stmt = $this->getCachedStatement( $conn, $path, $sql );
372
373
		foreach( $columns as $name => $entry ) {
374
			$stmt->bind( $idx++, $item->get( $name ), \Aimeos\Base\Criteria\SQL::type( $entry->getType() ) );
375
		}
376
377
		$stmt->bind( $idx++, $item->getLabel() );
378
		$stmt->bind( $idx++, $item->getCode() );
379
		$stmt->bind( $idx++, $billingAddress->getCompany() );
380
		$stmt->bind( $idx++, $billingAddress->getVatID() );
381
		$stmt->bind( $idx++, $billingAddress->getSalutation() );
382
		$stmt->bind( $idx++, $billingAddress->getTitle() );
383
		$stmt->bind( $idx++, $billingAddress->getFirstname() );
384
		$stmt->bind( $idx++, $billingAddress->getLastname() );
385
		$stmt->bind( $idx++, $billingAddress->getAddress1() );
386
		$stmt->bind( $idx++, $billingAddress->getAddress2() );
387
		$stmt->bind( $idx++, $billingAddress->getAddress3() );
388
		$stmt->bind( $idx++, $billingAddress->getPostal() );
389
		$stmt->bind( $idx++, $billingAddress->getCity() );
390
		$stmt->bind( $idx++, $billingAddress->getState() );
391
		$stmt->bind( $idx++, $billingAddress->getCountryId() );
392
		$stmt->bind( $idx++, $billingAddress->getLanguageId() );
393
		$stmt->bind( $idx++, $billingAddress->getTelephone() );
394
		$stmt->bind( $idx++, $billingAddress->getMobile() );
395
		$stmt->bind( $idx++, $billingAddress->getEmail() );
396
		$stmt->bind( $idx++, $billingAddress->getTelefax() );
397
		$stmt->bind( $idx++, $billingAddress->getWebsite() );
398
		$stmt->bind( $idx++, $billingAddress->getLongitude() );
399
		$stmt->bind( $idx++, $billingAddress->getLatitude() );
400
		$stmt->bind( $idx++, $billingAddress->getBirthday() );
401
		$stmt->bind( $idx++, $item->getStatus(), \Aimeos\Base\DB\Statement\Base::PARAM_INT );
402
		$stmt->bind( $idx++, $item->getDateVerified() );
403
		$stmt->bind( $idx++, $item->getPassword() );
404
		$stmt->bind( $idx++, $context->datetime() ); // Modification time
405
		$stmt->bind( $idx++, $context->editor() );
406
407
		if( $id !== null ) {
408
			$stmt->bind( $idx++, $context->locale()->getSiteId() . '%' );
409
			$stmt->bind( $idx++, $this->getUser()?->getSiteId() );
410
			$stmt->bind( $idx, $id, \Aimeos\Base\DB\Statement\Base::PARAM_INT );
411
			$billingAddress->setId( $id ); // enforce ID to be present
412
		} else {
413
			$stmt->bind( $idx++, $this->siteId( $item->getSiteId(), \Aimeos\MShop\Locale\Manager\Base::SITE_SUBTREE ) );
414
			$stmt->bind( $idx, $context->datetime() ); // Creation time
415
		}
416
417
		$stmt->execute()->finish();
418
419
		if( $id === null )
420
		{
421
			/** mshop/customer/manager/newid/mysql
422
			 * Retrieves the ID generated by the database when inserting a new record
423
			 *
424
			 * @see mshop/customer/manager/newid/ansi
425
			 */
426
427
			/** mshop/customer/manager/newid/ansi
428
			 * Retrieves the ID generated by the database when inserting a new record
429
			 *
430
			 * As soon as a new record is inserted into the database table,
431
			 * the database server generates a new and unique identifier for
432
			 * that record. This ID can be used for retrieving, updating and
433
			 * deleting that specific record from the table again.
434
			 *
435
			 * For MySQL:
436
			 *  SELECT LAST_INSERT_ID()
437
			 * For PostgreSQL:
438
			 *  SELECT currval('seq_mcus_id')
439
			 * For SQL Server:
440
			 *  SELECT SCOPE_IDENTITY()
441
			 * For Oracle:
442
			 *  SELECT "seq_mcus_id".CURRVAL FROM DUAL
443
			 *
444
			 * There's no way to retrive the new ID by a SQL statements that
445
			 * fits for most database servers as they implement their own
446
			 * specific way.
447
			 *
448
			 * @param string SQL statement for retrieving the last inserted record ID
449
			 * @since 2015.10
450
			 * @see mshop/customer/manager/insert/ansi
451
			 * @see mshop/customer/manager/update/ansi
452
			 * @see mshop/customer/manager/delete/ansi
453
			 * @see mshop/customer/manager/search/ansi
454
			 * @see mshop/customer/manager/count/ansi
455
			 */
456
			$path = 'mshop/customer/manager/newid';
457
			$id = $this->newId( $conn, $path );
458
		}
459
460
		return $this->saveDeps( $item->setId( $id ), $fetch );
461
	}
462
463
464
	/**
465
	 * Fetches the rows from the database statement and returns the list of items.
466
	 *
467
	 * @param \Aimeos\Base\DB\Result\Iface $stmt Database statement object
468
	 * @param array $ref List of domains whose items should be fetched too
469
	 * @param string $prefix Prefix for the property names
470
	 * @param array $attrs List of attributes that should be decoded
471
	 * @return \Aimeos\Map List of items implementing \Aimeos\MShop\Common\Item\Iface
472
	 */
473
	protected function fetch( \Aimeos\Base\DB\Result\Iface $results, array $ref, string $prefix = '', array $attrs = [] ) : \Aimeos\Map
474
	{
475
		$map = $items = $parentIds = $propItems = $addrItems = [];
476
477
		while( $row = $results->fetch() )
478
		{
479
			$map[$row['customer.id']] = $row;
480
			$parentIds[] = $row['customer.id'];
481
		}
482
483
		if( $this->hasRef( $ref, 'customer/address' ) ) {
484
			$addrItems = $this->getAddressItems( $parentIds, 'customer' );
485
		}
486
487
		if( $this->hasRef( $ref, 'customer/property' ) )
488
		{
489
			$name = 'customer/property';
490
			$propTypes = isset( $ref[$name] ) && is_array( $ref[$name] ) ? $ref[$name] : null;
491
492
			$propItems = $this->getPropertyItems( $parentIds, 'customer', $propTypes );
493
		}
494
495
		$listItems = map( $this->getListItems( $parentIds, $ref, 'customer' ) )->groupBy( 'customer.lists.parentid' );
496
497
		foreach( $map as $id => $row )
498
		{
499
			$row['.addritems'] = $addrItems[$id] ?? [];
500
			$row['.listitems'] = $listItems[$id] ?? [];
501
			$row['.propitems'] = $propItems[$id] ?? [];
502
503
			if( $item = $this->applyFilter( $this->create( $row ) ) ) {
504
				$items[$id] = $item;
505
			}
506
		}
507
508
		return map( $items );
509
	}
510
511
512
	/**
513
	 * Returns the prefix for the item properties and search keys.
514
	 *
515
	 * @return string Prefix for the item properties and search keys
516
	 */
517
	protected function prefix() : string
518
	{
519
		return 'customer.';
520
	}
521
522
523
	/**
524
	 * Saves the dependent items of the item
525
	 *
526
	 * @param \Aimeos\MShop\Common\Item\Iface $item Item object
527
	 * @param bool $fetch True if the new ID should be returned in the item
528
	 * @return \Aimeos\MShop\Common\Item\Iface Updated item
529
	 */
530
	protected function saveDeps( \Aimeos\MShop\Common\Item\Iface $item, bool $fetch = true ) : \Aimeos\MShop\Common\Item\Iface
531
	{
532
		$item = $this->savePropertyItems( $item, 'customer', $fetch );
533
		$item = $this->saveAddressItems( $item, 'customer', $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\AddressRef\Iface expected by parameter $item of Aimeos\MShop\Customer\Ma...ase::saveAddressItems(). ( Ignorable by Annotation )

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

533
		$item = $this->saveAddressItems( /** @scrutinizer ignore-type */ $item, 'customer', $fetch );
Loading history...
534
		return $this->saveListItems( $item, 'customer', $fetch );
535
	}
536
537
538
	/** mshop/customer/manager/name
539
	 * Class name of the used customer manager implementation
540
	 *
541
	 * Each default manager can be replace by an alternative imlementation.
542
	 * To use this implementation, you have to set the last part of the class
543
	 * name as configuration value so the manager factory knows which class it
544
	 * has to instantiate.
545
	 *
546
	 * For example, if the name of the default class is
547
	 *
548
	 *  \Aimeos\MShop\Customer\Manager\Standard
549
	 *
550
	 * and you want to replace it with your own version named
551
	 *
552
	 *  \Aimeos\MShop\Customer\Manager\Mymanager
553
	 *
554
	 * then you have to set the this configuration option:
555
	 *
556
	 *  mshop/customer/manager/name = Mymanager
557
	 *
558
	 * The value is the last part of your own class name and it's case sensitive,
559
	 * so take care that the configuration value is exactly named like the last
560
	 * part of the class name.
561
	 *
562
	 * The allowed characters of the class name are A-Z, a-z and 0-9. No other
563
	 * characters are possible! You should always start the last part of the class
564
	 * name with an upper case character and continue only with lower case characters
565
	 * or numbers. Avoid chamel case names like "MyManager"!
566
	 *
567
	 * @param string Last part of the class name
568
	 * @since 2015.10
569
	 */
570
571
	/** mshop/customer/manager/decorators/excludes
572
	 * Excludes decorators added by the "common" option from the customer manager
573
	 *
574
	 * Decorators extend the functionality of a class by adding new aspects
575
	 * (e.g. log what is currently done), executing the methods of the underlying
576
	 * class only in certain conditions (e.g. only for logged in users) or
577
	 * modify what is returned to the caller.
578
	 *
579
	 * This option allows you to remove a decorator added via
580
	 * "mshop/common/manager/decorators/default" before they are wrapped
581
	 * around the customer manager.
582
	 *
583
	 *  mshop/customer/manager/decorators/excludes = array( 'decorator1' )
584
	 *
585
	 * This would remove the decorator named "decorator1" from the list of
586
	 * common decorators ("\Aimeos\MShop\Common\Manager\Decorator\*") added via
587
	 * "mshop/common/manager/decorators/default" for the customer manager.
588
	 *
589
	 * @param array List of decorator names
590
	 * @since 2015.10
591
	 * @see mshop/common/manager/decorators/default
592
	 * @see mshop/customer/manager/decorators/global
593
	 * @see mshop/customer/manager/decorators/local
594
	 */
595
596
	/** mshop/customer/manager/decorators/global
597
	 * Adds a list of globally available decorators only to the customer manager
598
	 *
599
	 * Decorators extend the functionality of a class by adding new aspects
600
	 * (e.g. log what is currently done), executing the methods of the underlying
601
	 * class only in certain conditions (e.g. only for logged in users) or
602
	 * modify what is returned to the caller.
603
	 *
604
	 * This option allows you to wrap global decorators
605
	 * ("\Aimeos\MShop\Common\Manager\Decorator\*") around the customer manager.
606
	 *
607
	 *  mshop/customer/manager/decorators/global = array( 'decorator1' )
608
	 *
609
	 * This would add the decorator named "decorator1" defined by
610
	 * "\Aimeos\MShop\Common\Manager\Decorator\Decorator1" only to the customer
611
	 * manager.
612
	 *
613
	 * @param array List of decorator names
614
	 * @since 2015.10
615
	 * @see mshop/common/manager/decorators/default
616
	 * @see mshop/customer/manager/decorators/excludes
617
	 * @see mshop/customer/manager/decorators/local
618
	 */
619
620
	/** mshop/customer/manager/decorators/local
621
	 * Adds a list of local decorators only to the customer manager
622
	 *
623
	 * Decorators extend the functionality of a class by adding new aspects
624
	 * (e.g. log what is currently done), executing the methods of the underlying
625
	 * class only in certain conditions (e.g. only for logged in users) or
626
	 * modify what is returned to the caller.
627
	 *
628
	 * This option allows you to wrap local decorators
629
	 * ("\Aimeos\MShop\Customer\Manager\Decorator\*") around the customer manager.
630
	 *
631
	 *  mshop/customer/manager/decorators/local = array( 'decorator2' )
632
	 *
633
	 * This would add the decorator named "decorator2" defined by
634
	 * "\Aimeos\MShop\Customer\Manager\Decorator\Decorator2" only to the customer
635
	 * manager.
636
	 *
637
	 * @param array List of decorator names
638
	 * @since 2015.10
639
	 * @see mshop/common/manager/decorators/default
640
	 * @see mshop/customer/manager/decorators/excludes
641
	 * @see mshop/customer/manager/decorators/global
642
	 */
643
644
	/** mshop/customer/manager/resource
645
	 * Name of the database connection resource to use
646
	 *
647
	 * You can configure a different database connection for each data domain
648
	 * and if no such connection name exists, the "db" connection will be used.
649
	 * It's also possible to use the same database connection for different
650
	 * data domains by configuring the same connection name using this setting.
651
	 *
652
	 * @param string Database connection name
653
	 * @since 2023.04
654
	 */
655
656
	/** mshop/customer/manager/submanagers
657
	 * List of manager names that can be instantiated by the customer manager
658
	 *
659
	 * Managers provide a generic interface to the underlying storage.
660
	 * Each manager has or can have sub-managers caring about particular
661
	 * aspects. Each of these sub-managers can be instantiated by its
662
	 * parent manager using the getSubManager() method.
663
	 *
664
	 * The search keys from sub-managers can be normally used in the
665
	 * manager as well. It allows you to search for items of the manager
666
	 * using the search keys of the sub-managers to further limit the
667
	 * retrieved list of items.
668
	 *
669
	 * @param array List of sub-manager names
670
	 * @since 2015.10
671
	 */
672
673
	/** mshop/customer/manager/delete/mysql
674
	 * Deletes the items matched by the given IDs from the database
675
	 *
676
	 * @see mshop/customer/manager/delete/ansi
677
	 */
678
679
	/** mshop/customer/manager/delete/ansi
680
	 * Deletes the items matched by the given IDs from the database
681
	 *
682
	 * Removes the records specified by the given IDs from the customer database.
683
	 * The records must be from the site that is configured via the
684
	 * context item.
685
	 *
686
	 * The ":cond" placeholder is replaced by the name of the ID column and
687
	 * the given ID or list of IDs while the site ID is bound to the question
688
	 * mark.
689
	 *
690
	 * The SQL statement should conform to the ANSI standard to be
691
	 * compatible with most relational database systems. This also
692
	 * includes using double quotes for table and column names.
693
	 *
694
	 * @param string SQL statement for deleting items
695
	 * @since 2015.10
696
	 * @see mshop/customer/manager/insert/ansi
697
	 * @see mshop/customer/manager/update/ansi
698
	 * @see mshop/customer/manager/newid/ansi
699
	 * @see mshop/customer/manager/search/ansi
700
	 * @see mshop/customer/manager/count/ansi
701
	 */
702
703
	/** mshop/customer/manager/sitemode
704
	 * Mode how items from levels below or above in the site tree are handled
705
	 *
706
	 * By default, only items from the current site are fetched from the
707
	 * storage. If the ai-sites extension is installed, you can create a
708
	 * tree of sites. Then, this setting allows you to define for the
709
	 * whole customer domain if items from parent sites are inherited,
710
	 * sites from child sites are aggregated or both.
711
	 *
712
	 * Available constants for the site mode are:
713
	 * * 0 = only items from the current site
714
	 * * 1 = inherit items from parent sites
715
	 * * 2 = aggregate items from child sites
716
	 * * 3 = inherit and aggregate items at the same time
717
	 *
718
	 * You also need to set the mode in the locale manager
719
	 * (mshop/locale/manager/sitelevel) to one of the constants.
720
	 * If you set it to the same value, it will work as described but you
721
	 * can also use different modes. For example, if inheritance and
722
	 * aggregation is configured the locale manager but only inheritance
723
	 * in the domain manager because aggregating items makes no sense in
724
	 * this domain, then items wil be only inherited. Thus, you have full
725
	 * control over inheritance and aggregation in each domain.
726
	 *
727
	 * @param int Constant from Aimeos\MShop\Locale\Manager\Base class
728
	 * @since 2018.01
729
	 * @see mshop/locale/manager/sitelevel
730
	 */
731
732
	/** mshop/customer/manager/search/mysql
733
	 * Retrieves the records matched by the given criteria in the database
734
	 *
735
	 * @see mshop/customer/manager/search/ansi
736
	 */
737
738
	/** mshop/customer/manager/search/ansi
739
	 * Retrieves the records matched by the given criteria in the database
740
	 *
741
	 * Fetches the records matched by the given criteria from the customer
742
	 * database. The records must be from one of the sites that are
743
	 * configured via the context item. If the current site is part of
744
	 * a tree of sites, the SELECT statement can retrieve all records
745
	 * from the current site and the complete sub-tree of sites.
746
	 *
747
	 * As the records can normally be limited by criteria from sub-managers,
748
	 * their tables must be joined in the SQL context. This is done by
749
	 * using the "internaldeps" property from the definition of the ID
750
	 * column of the sub-managers. These internal dependencies specify
751
	 * the JOIN between the tables and the used columns for joining. The
752
	 * ":joins" placeholder is then replaced by the JOIN strings from
753
	 * the sub-managers.
754
	 *
755
	 * To limit the records matched, conditions can be added to the given
756
	 * criteria object. It can contain comparisons like column names that
757
	 * must match specific values which can be combined by AND, OR or NOT
758
	 * operators. The resulting string of SQL conditions replaces the
759
	 * ":cond" placeholder before the statement is sent to the database
760
	 * server.
761
	 *
762
	 * If the records that are retrieved should be ordered by one or more
763
	 * columns, the generated string of column / sort direction pairs
764
	 * replaces the ":order" placeholder. Columns of
765
	 * sub-managers can also be used for ordering the result set but then
766
	 * no index can be used.
767
	 *
768
	 * The number of returned records can be limited and can start at any
769
	 * number between the begining and the end of the result set. For that
770
	 * the ":size" and ":start" placeholders are replaced by the
771
	 * corresponding values from the criteria object. The default values
772
	 * are 0 for the start and 100 for the size value.
773
	 *
774
	 * The SQL statement should conform to the ANSI standard to be
775
	 * compatible with most relational database systems. This also
776
	 * includes using double quotes for table and column names.
777
	 *
778
	 * @param string SQL statement for searching items
779
	 * @since 2015.10
780
	 * @see mshop/customer/manager/insert/ansi
781
	 * @see mshop/customer/manager/update/ansi
782
	 * @see mshop/customer/manager/newid/ansi
783
	 * @see mshop/customer/manager/delete/ansi
784
	 * @see mshop/customer/manager/count/ansi
785
	 */
786
787
	/** mshop/customer/manager/count/mysql
788
	 * Counts the number of records matched by the given criteria in the database
789
	 *
790
	 * @see mshop/customer/manager/count/ansi
791
	 */
792
793
	/** mshop/customer/manager/count/ansi
794
	 * Counts the number of records matched by the given criteria in the database
795
	 *
796
	 * Counts all records matched by the given criteria from the customer
797
	 * database. The records must be from one of the sites that are
798
	 * configured via the context item. If the current site is part of
799
	 * a tree of sites, the statement can count all records from the
800
	 * current site and the complete sub-tree of sites.
801
	 *
802
	 * As the records can normally be limited by criteria from sub-managers,
803
	 * their tables must be joined in the SQL context. This is done by
804
	 * using the "internaldeps" property from the definition of the ID
805
	 * column of the sub-managers. These internal dependencies specify
806
	 * the JOIN between the tables and the used columns for joining. The
807
	 * ":joins" placeholder is then replaced by the JOIN strings from
808
	 * the sub-managers.
809
	 *
810
	 * To limit the records matched, conditions can be added to the given
811
	 * criteria object. It can contain comparisons like column names that
812
	 * must match specific values which can be combined by AND, OR or NOT
813
	 * operators. The resulting string of SQL conditions replaces the
814
	 * ":cond" placeholder before the statement is sent to the database
815
	 * server.
816
	 *
817
	 * Both, the strings for ":joins" and for ":cond" are the same as for
818
	 * the "search" SQL statement.
819
	 *
820
	 * Contrary to the "search" statement, it doesn't return any records
821
	 * but instead the number of records that have been found. As counting
822
	 * thousands of records can be a long running task, the maximum number
823
	 * of counted records is limited for performance reasons.
824
	 *
825
	 * The SQL statement should conform to the ANSI standard to be
826
	 * compatible with most relational database systems. This also
827
	 * includes using double quotes for table and column names.
828
	 *
829
	 * @param string SQL statement for counting items
830
	 * @since 2015.10
831
	 * @see mshop/customer/manager/insert/ansi
832
	 * @see mshop/customer/manager/update/ansi
833
	 * @see mshop/customer/manager/newid/ansi
834
	 * @see mshop/customer/manager/delete/ansi
835
	 * @see mshop/customer/manager/search/ansi
836
	 */
837
}
838