@@ -241,13 +241,13 @@ discard block |
||
241 | 241 | * |
242 | 242 | * @param array $siteids List of IDs for sites whose entries should be deleted |
243 | 243 | */ |
244 | - public function cleanup( array $siteids ) |
|
244 | + public function cleanup(array $siteids) |
|
245 | 245 | { |
246 | 246 | $path = 'mshop/customer/manager/submanagers'; |
247 | 247 | $default = ['address', 'group', 'lists', 'property']; |
248 | 248 | |
249 | - foreach( $this->getContext()->getConfig()->get( $path, $default ) as $domain ) { |
|
250 | - $this->getObject()->getSubManager( $domain )->cleanup( $siteids ); |
|
249 | + foreach ($this->getContext()->getConfig()->get($path, $default) as $domain) { |
|
250 | + $this->getObject()->getSubManager($domain)->cleanup($siteids); |
|
251 | 251 | } |
252 | 252 | } |
253 | 253 | |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | */ |
260 | 260 | public function createItem() |
261 | 261 | { |
262 | - return $this->createItemBase( ['customer.siteid' => $this->getContext()->getLocale()->getSiteId()] ); |
|
262 | + return $this->createItemBase(['customer.siteid' => $this->getContext()->getLocale()->getSiteId()]); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | |
@@ -268,10 +268,10 @@ discard block |
||
268 | 268 | * |
269 | 269 | * @param array $ids List of IDs |
270 | 270 | */ |
271 | - public function deleteItems( array $ids ) |
|
271 | + public function deleteItems(array $ids) |
|
272 | 272 | { |
273 | 273 | $path = 'mshop/customer/manager/laravel/delete'; |
274 | - $this->deleteItemsBase( $ids, $path, false ); |
|
274 | + $this->deleteItemsBase($ids, $path, false); |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | |
@@ -281,12 +281,12 @@ discard block |
||
281 | 281 | * @param boolean $withsub Return also attributes of sub-managers if true |
282 | 282 | * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
283 | 283 | */ |
284 | - public function getSearchAttributes( $withsub = true ) |
|
284 | + public function getSearchAttributes($withsub = true) |
|
285 | 285 | { |
286 | 286 | $path = 'mshop/customer/manager/submanagers'; |
287 | 287 | $default = ['address', 'group', 'lists', 'property']; |
288 | 288 | |
289 | - return $this->getSearchAttributesBase( $this->searchConfig, $path, $default, $withsub ); |
|
289 | + return $this->getSearchAttributesBase($this->searchConfig, $path, $default, $withsub); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | |
@@ -297,32 +297,32 @@ discard block |
||
297 | 297 | * @param boolean $fetch True if the new ID should be returned in the item |
298 | 298 | * @return \Aimeos\MShop\Common\Item\Iface $item Updated item including the generated ID |
299 | 299 | */ |
300 | - public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true ) |
|
300 | + public function saveItem(\Aimeos\MShop\Common\Item\Iface $item, $fetch = true) |
|
301 | 301 | { |
302 | 302 | $iface = '\\Aimeos\\MShop\\Customer\\Item\\Iface'; |
303 | - if( !( $item instanceof $iface ) ) { |
|
304 | - throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Object is not of required type "%1$s"', $iface ) ); |
|
303 | + if (!($item instanceof $iface)) { |
|
304 | + throw new \Aimeos\MShop\Customer\Exception(sprintf('Object is not of required type "%1$s"', $iface)); |
|
305 | 305 | } |
306 | 306 | |
307 | - if( !$item->isModified() ) |
|
307 | + if (!$item->isModified()) |
|
308 | 308 | { |
309 | - $item = $this->savePropertyItems( $item, 'customer' ); |
|
310 | - $item = $this->saveAddressItems( $item, 'customer' ); |
|
311 | - return $this->saveListItems( $item, 'customer' ); |
|
309 | + $item = $this->savePropertyItems($item, 'customer'); |
|
310 | + $item = $this->saveAddressItems($item, 'customer'); |
|
311 | + return $this->saveListItems($item, 'customer'); |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | $context = $this->getContext(); |
315 | 315 | $dbm = $context->getDatabaseManager(); |
316 | 316 | $dbname = $this->getResourceName(); |
317 | - $conn = $dbm->acquire( $dbname ); |
|
317 | + $conn = $dbm->acquire($dbname); |
|
318 | 318 | |
319 | 319 | try |
320 | 320 | { |
321 | 321 | $id = $item->getId(); |
322 | - $date = date( 'Y-m-d H:i:s' ); |
|
322 | + $date = date('Y-m-d H:i:s'); |
|
323 | 323 | $billingAddress = $item->getPaymentAddress(); |
324 | 324 | |
325 | - if( $id === null ) |
|
325 | + if ($id === null) |
|
326 | 326 | { |
327 | 327 | /** mshop/customer/manager/laravel/insert |
328 | 328 | * Inserts a new customer record into the database table |
@@ -386,48 +386,48 @@ discard block |
||
386 | 386 | $path = 'mshop/customer/manager/laravel/update'; |
387 | 387 | } |
388 | 388 | |
389 | - $stmt = $this->getCachedStatement( $conn, $path ); |
|
390 | - |
|
391 | - $stmt->bind( 1, $context->getLocale()->getSiteId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
392 | - $stmt->bind( 2, $item->getCode() ); |
|
393 | - $stmt->bind( 3, $billingAddress->getCompany() ); |
|
394 | - $stmt->bind( 4, $billingAddress->getVatID() ); |
|
395 | - $stmt->bind( 5, $billingAddress->getSalutation() ); |
|
396 | - $stmt->bind( 6, $billingAddress->getTitle() ); |
|
397 | - $stmt->bind( 7, $billingAddress->getFirstname() ); |
|
398 | - $stmt->bind( 8, $billingAddress->getLastname() ); |
|
399 | - $stmt->bind( 9, $billingAddress->getAddress1() ); |
|
400 | - $stmt->bind( 10, $billingAddress->getAddress2() ); |
|
401 | - $stmt->bind( 11, $billingAddress->getAddress3() ); |
|
402 | - $stmt->bind( 12, $billingAddress->getPostal() ); |
|
403 | - $stmt->bind( 13, $billingAddress->getCity() ); |
|
404 | - $stmt->bind( 14, $billingAddress->getState() ); |
|
405 | - $stmt->bind( 15, $billingAddress->getCountryId() ); |
|
406 | - $stmt->bind( 16, $billingAddress->getLanguageId() ); |
|
407 | - $stmt->bind( 17, $billingAddress->getTelephone() ); |
|
408 | - $stmt->bind( 18, $billingAddress->getTelefax() ); |
|
409 | - $stmt->bind( 19, $billingAddress->getWebsite() ); |
|
410 | - $stmt->bind( 20, $billingAddress->getEmail() ); |
|
411 | - $stmt->bind( 21, $billingAddress->getLongitude() ); |
|
412 | - $stmt->bind( 22, $billingAddress->getLatitude() ); |
|
413 | - $stmt->bind( 23, $item->getLabel() ); |
|
414 | - $stmt->bind( 24, $item->getBirthday() ); |
|
415 | - $stmt->bind( 25, $item->getStatus(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
416 | - $stmt->bind( 26, $item->getDateVerified() ); |
|
417 | - $stmt->bind( 27, $item->getPassword() ); |
|
418 | - $stmt->bind( 28, $date ); // Modification time |
|
419 | - $stmt->bind( 29, $context->getEditor() ); |
|
420 | - |
|
421 | - if( $id !== null ) { |
|
422 | - $stmt->bind( 30, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
423 | - $item->setId( $id ); |
|
389 | + $stmt = $this->getCachedStatement($conn, $path); |
|
390 | + |
|
391 | + $stmt->bind(1, $context->getLocale()->getSiteId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
392 | + $stmt->bind(2, $item->getCode()); |
|
393 | + $stmt->bind(3, $billingAddress->getCompany()); |
|
394 | + $stmt->bind(4, $billingAddress->getVatID()); |
|
395 | + $stmt->bind(5, $billingAddress->getSalutation()); |
|
396 | + $stmt->bind(6, $billingAddress->getTitle()); |
|
397 | + $stmt->bind(7, $billingAddress->getFirstname()); |
|
398 | + $stmt->bind(8, $billingAddress->getLastname()); |
|
399 | + $stmt->bind(9, $billingAddress->getAddress1()); |
|
400 | + $stmt->bind(10, $billingAddress->getAddress2()); |
|
401 | + $stmt->bind(11, $billingAddress->getAddress3()); |
|
402 | + $stmt->bind(12, $billingAddress->getPostal()); |
|
403 | + $stmt->bind(13, $billingAddress->getCity()); |
|
404 | + $stmt->bind(14, $billingAddress->getState()); |
|
405 | + $stmt->bind(15, $billingAddress->getCountryId()); |
|
406 | + $stmt->bind(16, $billingAddress->getLanguageId()); |
|
407 | + $stmt->bind(17, $billingAddress->getTelephone()); |
|
408 | + $stmt->bind(18, $billingAddress->getTelefax()); |
|
409 | + $stmt->bind(19, $billingAddress->getWebsite()); |
|
410 | + $stmt->bind(20, $billingAddress->getEmail()); |
|
411 | + $stmt->bind(21, $billingAddress->getLongitude()); |
|
412 | + $stmt->bind(22, $billingAddress->getLatitude()); |
|
413 | + $stmt->bind(23, $item->getLabel()); |
|
414 | + $stmt->bind(24, $item->getBirthday()); |
|
415 | + $stmt->bind(25, $item->getStatus(), \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
416 | + $stmt->bind(26, $item->getDateVerified()); |
|
417 | + $stmt->bind(27, $item->getPassword()); |
|
418 | + $stmt->bind(28, $date); // Modification time |
|
419 | + $stmt->bind(29, $context->getEditor()); |
|
420 | + |
|
421 | + if ($id !== null) { |
|
422 | + $stmt->bind(30, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
423 | + $item->setId($id); |
|
424 | 424 | } else { |
425 | - $stmt->bind( 30, $date ); // Creation time |
|
425 | + $stmt->bind(30, $date); // Creation time |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | $stmt->execute()->finish(); |
429 | 429 | |
430 | - if( $id === null && $fetch === true ) |
|
430 | + if ($id === null && $fetch === true) |
|
431 | 431 | { |
432 | 432 | /** mshop/customer/manager/laravel/newid |
433 | 433 | * Retrieves the ID generated by the database when inserting a new record |
@@ -460,22 +460,22 @@ discard block |
||
460 | 460 | * @see mshop/customer/manager/laravel/count |
461 | 461 | */ |
462 | 462 | $path = 'mshop/customer/manager/laravel/newid'; |
463 | - $item->setId( $this->newId( $conn, $path ) ); |
|
463 | + $item->setId($this->newId($conn, $path)); |
|
464 | 464 | } |
465 | 465 | |
466 | - $dbm->release( $conn, $dbname ); |
|
466 | + $dbm->release($conn, $dbname); |
|
467 | 467 | } |
468 | - catch( \Exception $e ) |
|
468 | + catch (\Exception $e) |
|
469 | 469 | { |
470 | - $dbm->release( $conn, $dbname ); |
|
470 | + $dbm->release($conn, $dbname); |
|
471 | 471 | throw $e; |
472 | 472 | } |
473 | 473 | |
474 | - $this->addGroups( $item ); |
|
474 | + $this->addGroups($item); |
|
475 | 475 | |
476 | - $item = $this->savePropertyItems( $item, 'customer' ); |
|
477 | - $item = $this->saveAddressItems( $item, 'customer' ); |
|
478 | - return $this->saveListItems( $item, 'customer' ); |
|
476 | + $item = $this->savePropertyItems($item, 'customer'); |
|
477 | + $item = $this->saveAddressItems($item, 'customer'); |
|
478 | + return $this->saveListItems($item, 'customer'); |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | |
@@ -487,11 +487,11 @@ discard block |
||
487 | 487 | * @return array List of items implementing \Aimeos\MShop\Customer\Item\Iface |
488 | 488 | * @throws \Aimeos\MShop\Customer\Exception If creating items failed |
489 | 489 | */ |
490 | - public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null ) |
|
490 | + public function searchItems(\Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null) |
|
491 | 491 | { |
492 | 492 | $dbm = $this->getContext()->getDatabaseManager(); |
493 | 493 | $dbname = $this->getResourceName(); |
494 | - $conn = $dbm->acquire( $dbname ); |
|
494 | + $conn = $dbm->acquire($dbname); |
|
495 | 495 | $map = []; |
496 | 496 | |
497 | 497 | try |
@@ -499,32 +499,32 @@ discard block |
||
499 | 499 | $level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL; |
500 | 500 | $cfgPathSearch = 'mshop/customer/manager/laravel/search'; |
501 | 501 | $cfgPathCount = 'mshop/customer/manager/laravel/count'; |
502 | - $required = array( 'customer' ); |
|
502 | + $required = array('customer'); |
|
503 | 503 | |
504 | - $results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level ); |
|
505 | - while( ( $row = $results->fetch() ) !== false ) { |
|
506 | - $map[ $row['customer.id'] ] = $row; |
|
504 | + $results = $this->searchItemsBase($conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level); |
|
505 | + while (($row = $results->fetch()) !== false) { |
|
506 | + $map[$row['customer.id']] = $row; |
|
507 | 507 | } |
508 | 508 | |
509 | - $dbm->release( $conn, $dbname ); |
|
509 | + $dbm->release($conn, $dbname); |
|
510 | 510 | } |
511 | - catch( \Exception $e ) |
|
511 | + catch (\Exception $e) |
|
512 | 512 | { |
513 | - $dbm->release( $conn, $dbname ); |
|
513 | + $dbm->release($conn, $dbname); |
|
514 | 514 | throw $e; |
515 | 515 | } |
516 | 516 | |
517 | 517 | $addrItems = []; |
518 | - if( in_array( 'customer/address', $ref, true ) ) { |
|
519 | - $addrItems = $this->getAddressItems( array_keys( $map ), 'customer' ); |
|
518 | + if (in_array('customer/address', $ref, true)) { |
|
519 | + $addrItems = $this->getAddressItems(array_keys($map), 'customer'); |
|
520 | 520 | } |
521 | 521 | |
522 | 522 | $propItems = []; |
523 | - if( in_array( 'customer/property', $ref, true ) ) { |
|
524 | - $propItems = $this->getPropertyItems( array_keys( $map ), 'customer' ); |
|
523 | + if (in_array('customer/property', $ref, true)) { |
|
524 | + $propItems = $this->getPropertyItems(array_keys($map), 'customer'); |
|
525 | 525 | } |
526 | 526 | |
527 | - return $this->buildItems( $map, $ref, 'customer', $addrItems, $propItems ); |
|
527 | + return $this->buildItems($map, $ref, 'customer', $addrItems, $propItems); |
|
528 | 528 | } |
529 | 529 | |
530 | 530 | |
@@ -535,8 +535,8 @@ discard block |
||
535 | 535 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
536 | 536 | * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
537 | 537 | */ |
538 | - public function getSubManager( $manager, $name = null ) |
|
538 | + public function getSubManager($manager, $name = null) |
|
539 | 539 | { |
540 | - return $this->getSubManagerBase( 'customer', $manager, ( $name === null ? 'Laravel' : $name ) ); |
|
540 | + return $this->getSubManagerBase('customer', $manager, ($name === null ? 'Laravel' : $name)); |
|
541 | 541 | } |
542 | 542 | } |