Passed
Push — master ( dc2098...bfd2b7 )
by Aimeos
04:38
created

Standard::saveRefs()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 7
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
	 * Saves a customer item object.
262
	 *
263
	 * @param \Aimeos\MShop\Customer\Item\Iface $item Customer item object
264
	 * @param bool $fetch True if the new ID should be returned in the item
265
	 * @return \Aimeos\MShop\Customer\Item\Iface $item Updated item including the generated ID
266
	 */
267
	protected function saveItem( \Aimeos\MShop\Customer\Item\Iface $item, bool $fetch = true ) : \Aimeos\MShop\Customer\Item\Iface
268
	{
269
		$item = $this->addGroups( $item );
270
271
		if( !$item->isModified() ) {
272
			return $this->object()->saveRefs( $item, $fetch );
273
		}
274
275
		$context = $this->context();
276
		$conn = $context->db( $this->getResourceName() );
277
278
		$id = $item->getId();
279
		$billingAddress = $item->getPaymentAddress();
280
		$columns = $this->object()->getSaveAttributes();
281
282
		if( $id === null )
283
		{
284
			/** mshop/customer/manager/insert/mysql
285
			 * Inserts a new customer record into the database table
286
			 *
287
			 * @see mshop/customer/manager/insert/ansi
288
			 */
289
290
			/** mshop/customer/manager/insert/ansi
291
			 * Inserts a new customer record into the database table
292
			 *
293
			 * Items with no ID yet (i.e. the ID is NULL) will be created in
294
			 * the database and the newly created ID retrieved afterwards
295
			 * using the "newid" SQL statement.
296
			 *
297
			 * The SQL statement must be a string suitable for being used as
298
			 * prepared statement. It must include question marks for binding
299
			 * the values from the customer item to the statement before they are
300
			 * sent to the database server. The number of question marks must
301
			 * be the same as the number of columns listed in the INSERT
302
			 * statement. The order of the columns must correspond to the
303
			 * order in the save() method, so the correct values are
304
			 * bound to the columns.
305
			 *
306
			 * The SQL statement should conform to the ANSI standard to be
307
			 * compatible with most relational database systems. This also
308
			 * includes using double quotes for table and column names.
309
			 *
310
			 * @param string SQL statement for inserting records
311
			 * @since 2015.10
312
			 * @see mshop/customer/manager/update/ansi
313
			 * @see mshop/customer/manager/newid/ansi
314
			 * @see mshop/customer/manager/delete/ansi
315
			 * @see mshop/customer/manager/search/ansi
316
			 * @see mshop/customer/manager/count/ansi
317
			 */
318
			$path = 'mshop/customer/manager/insert';
319
			$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

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