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

Standard::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

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