Passed
Push — master ( f602a9...185df8 )
by Aimeos
02:35
created

Laravel::__construct()   B

Complexity

Conditions 8
Paths 4

Size

Total Lines 40
Code Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 8
eloc 21
nc 4
nop 1
dl 0
loc 40
rs 8.4444
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2015-2018
6
 * @package MShop
7
 * @subpackage Customer
8
 */
9
10
11
namespace Aimeos\MShop\Customer\Manager;
12
13
14
/**
15
 * Customer class implementation for Friends of Symfony user bundle.
16
 *
17
 * @package MShop
18
 * @subpackage Customer
19
 */
20
class Laravel
21
	extends \Aimeos\MShop\Customer\Manager\Standard
22
{
23
	private $searchConfig = array(
24
		// customer.siteid is only for informational purpuse, not for filtering
25
		'customer.id' => array(
26
			'label' => 'Customer ID',
27
			'code' => 'customer.id',
28
			'internalcode' => 'lvu."id"',
29
			'type' => 'integer',
30
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT,
31
			'public' => false,
32
		),
33
		'customer.code' => array(
34
			'label' => 'Customer username',
35
			'code' => 'customer.code',
36
			'internalcode' => 'lvu."name"',
37
			'type' => 'string',
38
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR
39
		),
40
		'customer.label' => array(
41
			'label' => 'Customer label',
42
			'code' => 'customer.label',
43
			'internalcode' => 'lvu."label"',
44
			'type' => 'string',
45
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR
46
		),
47
		'customer.salutation' => array(
48
			'label' => 'Customer salutation',
49
			'code' => 'customer.salutation',
50
			'internalcode' => 'lvu."salutation"',
51
			'type' => 'string',
52
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
53
		),
54
		'customer.company'=> array(
55
			'label' => 'Customer company',
56
			'code' => 'customer.company',
57
			'internalcode' => 'lvu."company"',
58
			'type' => 'string',
59
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
60
		),
61
		'customer.vatid'=> array(
62
			'label' => 'Customer VAT ID',
63
			'code' => 'customer.vatid',
64
			'internalcode' => 'lvu."vatid"',
65
			'type' => 'string',
66
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
67
		),
68
		'customer.title' => array(
69
			'label' => 'Customer title',
70
			'code' => 'customer.title',
71
			'internalcode' => 'lvu."title"',
72
			'type' => 'string',
73
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
74
		),
75
		'customer.firstname' => array(
76
			'label' => 'Customer firstname',
77
			'code' => 'customer.firstname',
78
			'internalcode' => 'lvu."firstname"',
79
			'type' => 'string',
80
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
81
		),
82
		'customer.lastname' => array(
83
			'label' => 'Customer lastname',
84
			'code' => 'customer.lastname',
85
			'internalcode' => 'lvu."lastname"',
86
			'type' => 'string',
87
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
88
		),
89
		'customer.address1' => array(
90
			'label' => 'Customer address part one',
91
			'code' => 'customer.address1',
92
			'internalcode' => 'lvu."address1"',
93
			'type' => 'string',
94
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
95
		),
96
		'customer.address2' => array(
97
			'label' => 'Customer address part two',
98
			'code' => 'customer.address2',
99
			'internalcode' => 'lvu."address2"',
100
			'type' => 'string',
101
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
102
		),
103
		'customer.address3' => array(
104
			'label' => 'Customer address part three',
105
			'code' => 'customer.address3',
106
			'internalcode' => 'lvu."address3"',
107
			'type' => 'string',
108
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
109
		),
110
		'customer.postal' => array(
111
			'label' => 'Customer postal',
112
			'code' => 'customer.postal',
113
			'internalcode' => 'lvu."postal"',
114
			'type' => 'string',
115
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
116
		),
117
		'customer.city' => array(
118
			'label' => 'Customer city',
119
			'code' => 'customer.city',
120
			'internalcode' => 'lvu."city"',
121
			'type' => 'string',
122
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
123
		),
124
		'customer.state' => array(
125
			'label' => 'Customer state',
126
			'code' => 'customer.state',
127
			'internalcode' => 'lvu."state"',
128
			'type' => 'string',
129
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
130
		),
131
		'customer.languageid' => array(
132
			'label' => 'Customer language',
133
			'code' => 'customer.languageid',
134
			'internalcode' => 'lvu."langid"',
135
			'type' => 'string',
136
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
137
		),
138
		'customer.countryid' => array(
139
			'label' => 'Customer country',
140
			'code' => 'customer.countryid',
141
			'internalcode' => 'lvu."countryid"',
142
			'type' => 'string',
143
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
144
		),
145
		'customer.telephone' => array(
146
			'label' => 'Customer telephone',
147
			'code' => 'customer.telephone',
148
			'internalcode' => 'lvu."telephone"',
149
			'type' => 'string',
150
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
151
		),
152
		'customer.email' => array(
153
			'label' => 'Customer email',
154
			'code' => 'customer.email',
155
			'internalcode' => 'lvu."email"',
156
			'type' => 'string',
157
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
158
		),
159
		'customer.telefax' => array(
160
			'label' => 'Customer telefax',
161
			'code' => 'customer.telefax',
162
			'internalcode' => 'lvu."telefax"',
163
			'type' => 'string',
164
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
165
		),
166
		'customer.website' => array(
167
			'label' => 'Customer website',
168
			'code' => 'customer.website',
169
			'internalcode' => 'lvu."website"',
170
			'type' => 'string',
171
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
172
		),
173
		'customer.longitude' => array(
174
			'label' => 'Customer longitude',
175
			'code' => 'customer.longitude',
176
			'internalcode' => 'lvu."longitude"',
177
			'type' => 'float',
178
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_FLOAT,
179
		),
180
		'customer.latitude' => array(
181
			'label' => 'Customer latitude',
182
			'code' => 'customer.latitude',
183
			'internalcode' => 'lvu."latitude"',
184
			'type' => 'float',
185
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_FLOAT,
186
		),
187
		'customer.birthday' => array(
188
			'label' => 'Customer birthday',
189
			'code' => 'customer.birthday',
190
			'internalcode' => 'lvu."birthday"',
191
			'type' => 'string',
192
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
193
		),
194
		'customer.password'=> array(
195
			'label' => 'Customer password',
196
			'code' => 'customer.password',
197
			'internalcode' => 'lvu."password"',
198
			'type' => 'string',
199
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
200
		),
201
		'customer.status'=> array(
202
			'label' => 'Customer status',
203
			'code' => 'customer.status',
204
			'internalcode' => 'lvu."status"',
205
			'type' => 'integer',
206
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT
207
		),
208
		'customer.dateverified'=> array(
209
			'label' => 'Customer verification date',
210
			'code' => 'customer.dateverified',
211
			'internalcode' => 'lvu."vdate"',
212
			'type' => 'date',
213
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
214
		),
215
		'customer.ctime'=> array(
216
			'label' => 'Customer creation time',
217
			'code' => 'customer.ctime',
218
			'internalcode' => 'lvu."created_at"',
219
			'type' => 'datetime',
220
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
221
		),
222
		'customer.mtime'=> array(
223
			'label' => 'Customer modification time',
224
			'code' => 'customer.mtime',
225
			'internalcode' => 'lvu."updated_at"',
226
			'type' => 'datetime',
227
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
228
		),
229
		'customer.editor'=> array(
230
			'label'=>'Customer editor',
231
			'code'=>'customer.editor',
232
			'internalcode' => 'lvu."editor"',
233
			'type'=> 'string',
234
			'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR,
235
		),
236
		'customer:has' => array(
237
			'code' => 'customer:has()',
238
			'internalcode' => '(
239
				SELECT lvuli_has."id" FROM users_list AS lvuli_has
240
				WHERE lvu."id" = lvuli_has."parentid" AND :site AND lvuli_has."domain" = $1 :type :refid
241
				LIMIT 1
242
			)',
243
			'label' => 'Customer has list item, parameter(<domain>[,<list type>[,<reference ID>)]]',
244
			'type' => 'null',
245
			'internaltype' => 'null',
246
			'public' => false,
247
		),
248
		'customer:prop' => array(
249
			'code' => 'customer:prop()',
250
			'internalcode' => '(
251
				SELECT lvupr_prop."id" FROM users_property AS lvupr_prop
252
				WHERE lvu."id" = lvupr_prop."parentid" AND :site AND lvupr_prop."type" = $1 :langid :value
253
				LIMIT 1
254
			)',
255
			'label' => 'Customer has property item, parameter(<property type>[,<language code>[,<property value>]])',
256
			'type' => 'null',
257
			'internaltype' => 'null',
258
			'public' => false,
259
		),
260
	);
261
262
263
	/**
264
	 * Initializes the object.
265
	 *
266
	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
267
	 */
268
	public function __construct( \Aimeos\MShop\Context\Item\Iface $context )
269
	{
270
		parent::__construct( $context );
271
272
		$locale = $context->getLocale();
273
		$level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL;
274
		$level = $context->getConfig()->get( 'mshop/customer/manager/sitemode', $level );
275
276
		$siteIds = [$locale->getSiteId()];
277
278
		if( $level & \Aimeos\MShop\Locale\Manager\Base::SITE_PATH ) {
279
			$siteIds = array_merge( $siteIds, $locale->getSitePath() );
280
		}
281
282
		if( $level & \Aimeos\MShop\Locale\Manager\Base::SITE_SUBTREE ) {
283
			$siteIds = array_merge( $siteIds, $locale->getSiteSubTree() );
284
		}
285
286
		$this->replaceSiteMarker( $this->searchConfig['customer:has'], 'lvuli_has."siteid"', $siteIds, ':site' );
287
		$this->replaceSiteMarker( $this->searchConfig['customer:prop'], 'lvupr_prop."siteid"', $siteIds, ':site' );
288
289
290
		$this->searchConfig['customer:has']['function'] = function( &$source, array $params ) {
291
292
			$source = str_replace( ':type', isset( $params[1] ) ? 'AND lvuli_has."type" = $2' : '', $source );
293
			$source = str_replace( ':refid', isset( $params[2] ) ? 'AND lvuli_has."refid" = $3' : '', $source );
294
295
			return $params;
296
		};
297
298
299
		$this->searchConfig['customer:prop']['function'] = function( &$source, array $params ) {
300
301
			$lang = 'AND lvupr_prop."langid"';
302
			$lang = isset( $params[1] ) ? ( $params[1] !== 'null' ? $lang . ' = $2' : $lang . ' IS NULL' ) : '';
303
304
			$source = str_replace( ':langid', $lang, $source );
305
			$source = str_replace( ':value', isset( $params[2] ) ? 'AND lvupr_prop."value" = $3' : '', $source );
306
307
			return $params;
308
		};
309
	}
310
311
312
	/**
313
	 * Removes old entries from the storage.
314
	 *
315
	 * @param array $siteids List of IDs for sites whose entries should be deleted
316
	 */
317
	public function cleanup( array $siteids )
318
	{
319
		$path = 'mshop/customer/manager/submanagers';
320
		$default = ['address', 'group', 'lists', 'property'];
321
322
		foreach( $this->getContext()->getConfig()->get( $path, $default ) as $domain ) {
323
			$this->getObject()->getSubManager( $domain )->cleanup( $siteids );
324
		}
325
	}
326
327
328
	/**
329
	 * Removes multiple items specified by ids in the array.
330
	 *
331
	 * @param array $ids List of IDs
332
	 */
333
	public function deleteItems( array $ids )
334
	{
335
		$path = 'mshop/customer/manager/laravel/delete';
336
		$this->deleteItemsBase( $ids, $path, false );
337
	}
338
339
340
	/**
341
	 * Returns the list attributes that can be used for searching.
342
	 *
343
	 * @param boolean $withsub Return also attributes of sub-managers if true
344
	 * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface
345
	 */
346
	public function getSearchAttributes( $withsub = true )
347
	{
348
		$path = 'mshop/customer/manager/submanagers';
349
		$default = ['address', 'group', 'lists', 'property'];
350
351
		return $this->getSearchAttributesBase( $this->searchConfig, $path, $default, $withsub );
352
	}
353
354
355
	/**
356
	 * Saves a customer item object.
357
	 *
358
	 * @param \Aimeos\MShop\Customer\Item\Iface $item Customer item object
359
	 * @param boolean $fetch True if the new ID should be returned in the item
360
	 * @return \Aimeos\MShop\Common\Item\Iface $item Updated item including the generated ID
361
	 */
362
	public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true )
363
	{
364
		self::checkClass( '\\Aimeos\\MShop\\Customer\\Item\\Iface', $item );
365
366
		$item = $this->addGroups( $item );
367
368
		if( !$item->isModified() )
369
		{
370
			$item = $this->savePropertyItems( $item, 'customer' );
371
			$item = $this->saveAddressItems( $item, 'customer' );
372
			return $this->saveListItems( $item, 'customer' );
373
		}
374
375
		$context = $this->getContext();
376
		$dbm = $context->getDatabaseManager();
377
		$dbname = $this->getResourceName();
378
		$conn = $dbm->acquire( $dbname );
379
380
		try
381
		{
382
			$id = $item->getId();
383
			$date = date( 'Y-m-d H:i:s' );
384
			$billingAddress = $item->getPaymentAddress();
385
386
			if( $id === null )
387
			{
388
				/** mshop/customer/manager/laravel/insert
389
				 * Inserts a new customer record into the database table
390
				 *
391
				 * Items with no ID yet (i.e. the ID is NULL) will be created in
392
				 * the database and the newly created ID retrieved afterwards
393
				 * using the "newid" SQL statement.
394
				 *
395
				 * The SQL statement must be a string suitable for being used as
396
				 * prepared statement. It must include question marks for binding
397
				 * the values from the customer item to the statement before they are
398
				 * sent to the database server. The number of question marks must
399
				 * be the same as the number of columns listed in the INSERT
400
				 * statement. The order of the columns must correspond to the
401
				 * order in the saveItems() method, so the correct values are
402
				 * bound to the columns.
403
				 *
404
				 * The SQL statement should conform to the ANSI standard to be
405
				 * compatible with most relational database systems. This also
406
				 * includes using double quotes for table and column names.
407
				 *
408
				 * @param string SQL statement for inserting records
409
				 * @since 2015.01
410
				 * @category Developer
411
				 * @see mshop/customer/manager/laravel/update
412
				 * @see mshop/customer/manager/laravel/newid
413
				 * @see mshop/customer/manager/laravel/delete
414
				 * @see mshop/customer/manager/laravel/search
415
				 * @see mshop/customer/manager/laravel/count
416
				 */
417
				$path = 'mshop/customer/manager/laravel/insert';
418
			}
419
			else
420
			{
421
				/** mshop/customer/manager/laravel/update
422
				 * Updates an existing customer record in the database
423
				 *
424
				 * Items which already have an ID (i.e. the ID is not NULL) will
425
				 * be updated in the database.
426
				 *
427
				 * The SQL statement must be a string suitable for being used as
428
				 * prepared statement. It must include question marks for binding
429
				 * the values from the customer item to the statement before they are
430
				 * sent to the database server. The order of the columns must
431
				 * correspond to the order in the saveItems() method, so the
432
				 * correct values are bound to the columns.
433
				 *
434
				 * The SQL statement should conform to the ANSI standard to be
435
				 * compatible with most relational database systems. This also
436
				 * includes using double quotes for table and column names.
437
				 *
438
				 * @param string SQL statement for updating records
439
				 * @since 2015.01
440
				 * @category Developer
441
				 * @see mshop/customer/manager/laravel/insert
442
				 * @see mshop/customer/manager/laravel/newid
443
				 * @see mshop/customer/manager/laravel/delete
444
				 * @see mshop/customer/manager/laravel/search
445
				 * @see mshop/customer/manager/laravel/count
446
				 */
447
				$path = 'mshop/customer/manager/laravel/update';
448
			}
449
450
			$stmt = $this->getCachedStatement( $conn, $path );
451
452
			$stmt->bind( 1, $context->getLocale()->getSiteId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT );
453
			$stmt->bind( 2, $item->getCode() );
454
			$stmt->bind( 3, $billingAddress->getCompany() );
455
			$stmt->bind( 4, $billingAddress->getVatID() );
456
			$stmt->bind( 5, $billingAddress->getSalutation() );
457
			$stmt->bind( 6, $billingAddress->getTitle() );
458
			$stmt->bind( 7, $billingAddress->getFirstname() );
459
			$stmt->bind( 8, $billingAddress->getLastname() );
460
			$stmt->bind( 9, $billingAddress->getAddress1() );
461
			$stmt->bind( 10, $billingAddress->getAddress2() );
462
			$stmt->bind( 11, $billingAddress->getAddress3() );
463
			$stmt->bind( 12, $billingAddress->getPostal() );
464
			$stmt->bind( 13, $billingAddress->getCity() );
465
			$stmt->bind( 14, $billingAddress->getState() );
466
			$stmt->bind( 15, $billingAddress->getCountryId() );
467
			$stmt->bind( 16, $billingAddress->getLanguageId() );
468
			$stmt->bind( 17, $billingAddress->getTelephone() );
469
			$stmt->bind( 18, $billingAddress->getTelefax() );
470
			$stmt->bind( 19, $billingAddress->getWebsite() );
471
			$stmt->bind( 20, $billingAddress->getEmail() );
472
			$stmt->bind( 21, $billingAddress->getLongitude(), \Aimeos\MW\DB\Statement\Base::PARAM_FLOAT );
473
			$stmt->bind( 22, $billingAddress->getLatitude(), \Aimeos\MW\DB\Statement\Base::PARAM_FLOAT );
474
			$stmt->bind( 23, $item->getLabel() );
475
			$stmt->bind( 24, $item->getBirthday() );
476
			$stmt->bind( 25, $item->getStatus(), \Aimeos\MW\DB\Statement\Base::PARAM_INT );
477
			$stmt->bind( 26, $item->getDateVerified() );
478
			$stmt->bind( 27, $item->getPassword() );
479
			$stmt->bind( 28, $date ); // Modification time
480
			$stmt->bind( 29, $context->getEditor() );
481
482
			if( $id !== null ) {
483
				$stmt->bind( 30, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT );
484
				$item->setId( $id );
485
			} else {
486
				$stmt->bind( 30, $date ); // Creation time
487
			}
488
489
			$stmt->execute()->finish();
490
491
			if( $id === null && $fetch === true )
492
			{
493
				/** mshop/customer/manager/laravel/newid
494
				 * Retrieves the ID generated by the database when inserting a new record
495
				 *
496
				 * As soon as a new record is inserted into the database table,
497
				 * the database server generates a new and unique identifier for
498
				 * that record. This ID can be used for retrieving, updating and
499
				 * deleting that specific record from the table again.
500
				 *
501
				 * For MySQL:
502
				 *  SELECT LAST_INSERT_ID()
503
				 * For PostgreSQL:
504
				 *  SELECT currval('seq_mcus_id')
505
				 * For SQL Server:
506
				 *  SELECT SCOPE_IDENTITY()
507
				 * For Oracle:
508
				 *  SELECT "seq_mcus_id".CURRVAL FROM DUAL
509
				 *
510
				 * There's no way to retrive the new ID by a SQL statements that
511
				 * fits for most database servers as they implement their own
512
				 * specific way.
513
				 *
514
				 * @param string SQL statement for retrieving the last inserted record ID
515
				 * @since 2015.01
516
				 * @category Developer
517
				 * @see mshop/customer/manager/laravel/insert
518
				 * @see mshop/customer/manager/laravel/update
519
				 * @see mshop/customer/manager/laravel/delete
520
				 * @see mshop/customer/manager/laravel/search
521
				 * @see mshop/customer/manager/laravel/count
522
				 */
523
				$path = 'mshop/customer/manager/laravel/newid';
524
				$item->setId( $this->newId( $conn, $path ) );
525
			}
526
527
			$dbm->release( $conn, $dbname );
528
		}
529
		catch( \Exception $e )
530
		{
531
			$dbm->release( $conn, $dbname );
532
			throw $e;
533
		}
534
535
		$item = $this->savePropertyItems( $item, 'customer' );
536
		$item = $this->saveAddressItems( $item, 'customer' );
537
		return $this->saveListItems( $item, 'customer' );
538
	}
539
540
541
	/**
542
	 * Returns the item objects matched by the given search criteria.
543
	 *
544
	 * @param \Aimeos\MW\Criteria\Iface $search Search criteria object
545
	 * @param integer &$total Number of items that are available in total
546
	 * @return array List of items implementing \Aimeos\MShop\Customer\Item\Iface
547
	 * @throws \Aimeos\MShop\Customer\Exception If creating items failed
548
	 */
549
	public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null )
550
	{
551
		$dbm = $this->getContext()->getDatabaseManager();
552
		$dbname = $this->getResourceName();
553
		$conn = $dbm->acquire( $dbname );
554
		$map = [];
555
556
		try
557
		{
558
			$level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL;
559
			$cfgPathSearch = 'mshop/customer/manager/laravel/search';
560
			$cfgPathCount = 'mshop/customer/manager/laravel/count';
561
			$ref[] = 'customer/group';
562
			$required = ['customer'];
563
564
			$results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level );
565
			while( ( $row = $results->fetch() ) !== false ) {
566
				$map[ $row['customer.id'] ] = $row;
567
			}
568
569
			$dbm->release( $conn, $dbname );
570
		}
571
		catch( \Exception $e )
572
		{
573
			$dbm->release( $conn, $dbname  );
574
			throw $e;
575
		}
576
577
		$addrItems = [];
578
		if( in_array( 'customer/address', $ref, true ) ) {
579
			$addrItems = $this->getAddressItems( array_keys( $map ), 'customer' );
580
		}
581
582
		$propItems = [];
583
		if( in_array( 'customer/property', $ref, true ) ) {
584
			$propItems = $this->getPropertyItems( array_keys( $map ), 'customer' );
585
		}
586
587
		return $this->buildItems( $map, $ref, 'customer', $addrItems, $propItems );
588
	}
589
590
591
	/**
592
	 * Returns a new manager for customer extensions
593
	 *
594
	 * @param string $manager Name of the sub manager type in lower case
595
	 * @param string|null $name Name of the implementation, will be from configuration (or Default) if null
596
	 * @return mixed Manager for different extensions, e.g stock, tags, locations, etc.
597
	 */
598
	public function getSubManager( $manager, $name = null )
599
	{
600
		return $this->getSubManagerBase( 'customer', $manager, ( $name === null ? 'Laravel' : $name ) );
601
	}
602
}
603