@@ -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 | |
@@ -257,10 +257,10 @@ discard block |
||
| 257 | 257 | * |
| 258 | 258 | * @param array $ids List of IDs |
| 259 | 259 | */ |
| 260 | - public function deleteItems( array $ids ) |
|
| 260 | + public function deleteItems(array $ids) |
|
| 261 | 261 | { |
| 262 | 262 | $path = 'mshop/customer/manager/laravel/delete'; |
| 263 | - $this->deleteItemsBase( $ids, $path, false ); |
|
| 263 | + $this->deleteItemsBase($ids, $path, false); |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | |
@@ -270,12 +270,12 @@ discard block |
||
| 270 | 270 | * @param boolean $withsub Return also attributes of sub-managers if true |
| 271 | 271 | * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
| 272 | 272 | */ |
| 273 | - public function getSearchAttributes( $withsub = true ) |
|
| 273 | + public function getSearchAttributes($withsub = true) |
|
| 274 | 274 | { |
| 275 | 275 | $path = 'mshop/customer/manager/submanagers'; |
| 276 | 276 | $default = ['address', 'group', 'lists', 'property']; |
| 277 | 277 | |
| 278 | - return $this->getSearchAttributesBase( $this->searchConfig, $path, $default, $withsub ); |
|
| 278 | + return $this->getSearchAttributesBase($this->searchConfig, $path, $default, $withsub); |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | |
@@ -286,32 +286,32 @@ discard block |
||
| 286 | 286 | * @param boolean $fetch True if the new ID should be returned in the item |
| 287 | 287 | * @return \Aimeos\MShop\Common\Item\Iface $item Updated item including the generated ID |
| 288 | 288 | */ |
| 289 | - public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true ) |
|
| 289 | + public function saveItem(\Aimeos\MShop\Common\Item\Iface $item, $fetch = true) |
|
| 290 | 290 | { |
| 291 | 291 | $iface = '\\Aimeos\\MShop\\Customer\\Item\\Iface'; |
| 292 | - if( !( $item instanceof $iface ) ) { |
|
| 293 | - throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Object is not of required type "%1$s"', $iface ) ); |
|
| 292 | + if (!($item instanceof $iface)) { |
|
| 293 | + throw new \Aimeos\MShop\Customer\Exception(sprintf('Object is not of required type "%1$s"', $iface)); |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | - if( !$item->isModified() ) |
|
| 296 | + if (!$item->isModified()) |
|
| 297 | 297 | { |
| 298 | - $item = $this->savePropertyItems( $item, 'customer' ); |
|
| 299 | - $item = $this->saveAddressItems( $item, 'customer' ); |
|
| 300 | - return $this->saveListItems( $item, 'customer' ); |
|
| 298 | + $item = $this->savePropertyItems($item, 'customer'); |
|
| 299 | + $item = $this->saveAddressItems($item, 'customer'); |
|
| 300 | + return $this->saveListItems($item, 'customer'); |
|
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | $context = $this->getContext(); |
| 304 | 304 | $dbm = $context->getDatabaseManager(); |
| 305 | 305 | $dbname = $this->getResourceName(); |
| 306 | - $conn = $dbm->acquire( $dbname ); |
|
| 306 | + $conn = $dbm->acquire($dbname); |
|
| 307 | 307 | |
| 308 | 308 | try |
| 309 | 309 | { |
| 310 | 310 | $id = $item->getId(); |
| 311 | - $date = date( 'Y-m-d H:i:s' ); |
|
| 311 | + $date = date('Y-m-d H:i:s'); |
|
| 312 | 312 | $billingAddress = $item->getPaymentAddress(); |
| 313 | 313 | |
| 314 | - if( $id === null ) |
|
| 314 | + if ($id === null) |
|
| 315 | 315 | { |
| 316 | 316 | /** mshop/customer/manager/laravel/insert |
| 317 | 317 | * Inserts a new customer record into the database table |
@@ -375,48 +375,48 @@ discard block |
||
| 375 | 375 | $path = 'mshop/customer/manager/laravel/update'; |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | - $stmt = $this->getCachedStatement( $conn, $path ); |
|
| 379 | - |
|
| 380 | - $stmt->bind( 1, $context->getLocale()->getSiteId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
| 381 | - $stmt->bind( 2, $item->getCode() ); |
|
| 382 | - $stmt->bind( 3, $billingAddress->getCompany() ); |
|
| 383 | - $stmt->bind( 4, $billingAddress->getVatID() ); |
|
| 384 | - $stmt->bind( 5, $billingAddress->getSalutation() ); |
|
| 385 | - $stmt->bind( 6, $billingAddress->getTitle() ); |
|
| 386 | - $stmt->bind( 7, $billingAddress->getFirstname() ); |
|
| 387 | - $stmt->bind( 8, $billingAddress->getLastname() ); |
|
| 388 | - $stmt->bind( 9, $billingAddress->getAddress1() ); |
|
| 389 | - $stmt->bind( 10, $billingAddress->getAddress2() ); |
|
| 390 | - $stmt->bind( 11, $billingAddress->getAddress3() ); |
|
| 391 | - $stmt->bind( 12, $billingAddress->getPostal() ); |
|
| 392 | - $stmt->bind( 13, $billingAddress->getCity() ); |
|
| 393 | - $stmt->bind( 14, $billingAddress->getState() ); |
|
| 394 | - $stmt->bind( 15, $billingAddress->getCountryId() ); |
|
| 395 | - $stmt->bind( 16, $billingAddress->getLanguageId() ); |
|
| 396 | - $stmt->bind( 17, $billingAddress->getTelephone() ); |
|
| 397 | - $stmt->bind( 18, $billingAddress->getTelefax() ); |
|
| 398 | - $stmt->bind( 19, $billingAddress->getWebsite() ); |
|
| 399 | - $stmt->bind( 20, $billingAddress->getEmail() ); |
|
| 400 | - $stmt->bind( 21, $billingAddress->getLongitude() ); |
|
| 401 | - $stmt->bind( 22, $billingAddress->getLatitude() ); |
|
| 402 | - $stmt->bind( 23, $item->getLabel() ); |
|
| 403 | - $stmt->bind( 24, $item->getBirthday() ); |
|
| 404 | - $stmt->bind( 25, $item->getStatus(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
| 405 | - $stmt->bind( 26, $item->getDateVerified() ); |
|
| 406 | - $stmt->bind( 27, $item->getPassword() ); |
|
| 407 | - $stmt->bind( 28, $date ); // Modification time |
|
| 408 | - $stmt->bind( 29, $context->getEditor() ); |
|
| 409 | - |
|
| 410 | - if( $id !== null ) { |
|
| 411 | - $stmt->bind( 30, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
| 412 | - $item->setId( $id ); |
|
| 378 | + $stmt = $this->getCachedStatement($conn, $path); |
|
| 379 | + |
|
| 380 | + $stmt->bind(1, $context->getLocale()->getSiteId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
| 381 | + $stmt->bind(2, $item->getCode()); |
|
| 382 | + $stmt->bind(3, $billingAddress->getCompany()); |
|
| 383 | + $stmt->bind(4, $billingAddress->getVatID()); |
|
| 384 | + $stmt->bind(5, $billingAddress->getSalutation()); |
|
| 385 | + $stmt->bind(6, $billingAddress->getTitle()); |
|
| 386 | + $stmt->bind(7, $billingAddress->getFirstname()); |
|
| 387 | + $stmt->bind(8, $billingAddress->getLastname()); |
|
| 388 | + $stmt->bind(9, $billingAddress->getAddress1()); |
|
| 389 | + $stmt->bind(10, $billingAddress->getAddress2()); |
|
| 390 | + $stmt->bind(11, $billingAddress->getAddress3()); |
|
| 391 | + $stmt->bind(12, $billingAddress->getPostal()); |
|
| 392 | + $stmt->bind(13, $billingAddress->getCity()); |
|
| 393 | + $stmt->bind(14, $billingAddress->getState()); |
|
| 394 | + $stmt->bind(15, $billingAddress->getCountryId()); |
|
| 395 | + $stmt->bind(16, $billingAddress->getLanguageId()); |
|
| 396 | + $stmt->bind(17, $billingAddress->getTelephone()); |
|
| 397 | + $stmt->bind(18, $billingAddress->getTelefax()); |
|
| 398 | + $stmt->bind(19, $billingAddress->getWebsite()); |
|
| 399 | + $stmt->bind(20, $billingAddress->getEmail()); |
|
| 400 | + $stmt->bind(21, $billingAddress->getLongitude()); |
|
| 401 | + $stmt->bind(22, $billingAddress->getLatitude()); |
|
| 402 | + $stmt->bind(23, $item->getLabel()); |
|
| 403 | + $stmt->bind(24, $item->getBirthday()); |
|
| 404 | + $stmt->bind(25, $item->getStatus(), \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
| 405 | + $stmt->bind(26, $item->getDateVerified()); |
|
| 406 | + $stmt->bind(27, $item->getPassword()); |
|
| 407 | + $stmt->bind(28, $date); // Modification time |
|
| 408 | + $stmt->bind(29, $context->getEditor()); |
|
| 409 | + |
|
| 410 | + if ($id !== null) { |
|
| 411 | + $stmt->bind(30, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
| 412 | + $item->setId($id); |
|
| 413 | 413 | } else { |
| 414 | - $stmt->bind( 30, $date ); // Creation time |
|
| 414 | + $stmt->bind(30, $date); // Creation time |
|
| 415 | 415 | } |
| 416 | 416 | |
| 417 | 417 | $stmt->execute()->finish(); |
| 418 | 418 | |
| 419 | - if( $id === null && $fetch === true ) |
|
| 419 | + if ($id === null && $fetch === true) |
|
| 420 | 420 | { |
| 421 | 421 | /** mshop/customer/manager/laravel/newid |
| 422 | 422 | * Retrieves the ID generated by the database when inserting a new record |
@@ -449,22 +449,22 @@ discard block |
||
| 449 | 449 | * @see mshop/customer/manager/laravel/count |
| 450 | 450 | */ |
| 451 | 451 | $path = 'mshop/customer/manager/laravel/newid'; |
| 452 | - $item->setId( $this->newId( $conn, $path ) ); |
|
| 452 | + $item->setId($this->newId($conn, $path)); |
|
| 453 | 453 | } |
| 454 | 454 | |
| 455 | - $dbm->release( $conn, $dbname ); |
|
| 455 | + $dbm->release($conn, $dbname); |
|
| 456 | 456 | } |
| 457 | - catch( \Exception $e ) |
|
| 457 | + catch (\Exception $e) |
|
| 458 | 458 | { |
| 459 | - $dbm->release( $conn, $dbname ); |
|
| 459 | + $dbm->release($conn, $dbname); |
|
| 460 | 460 | throw $e; |
| 461 | 461 | } |
| 462 | 462 | |
| 463 | - $this->addGroups( $item ); |
|
| 463 | + $this->addGroups($item); |
|
| 464 | 464 | |
| 465 | - $item = $this->savePropertyItems( $item, 'customer' ); |
|
| 466 | - $item = $this->saveAddressItems( $item, 'customer' ); |
|
| 467 | - return $this->saveListItems( $item, 'customer' ); |
|
| 465 | + $item = $this->savePropertyItems($item, 'customer'); |
|
| 466 | + $item = $this->saveAddressItems($item, 'customer'); |
|
| 467 | + return $this->saveListItems($item, 'customer'); |
|
| 468 | 468 | } |
| 469 | 469 | |
| 470 | 470 | |
@@ -476,11 +476,11 @@ discard block |
||
| 476 | 476 | * @return array List of items implementing \Aimeos\MShop\Customer\Item\Iface |
| 477 | 477 | * @throws \Aimeos\MShop\Customer\Exception If creating items failed |
| 478 | 478 | */ |
| 479 | - public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null ) |
|
| 479 | + public function searchItems(\Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null) |
|
| 480 | 480 | { |
| 481 | 481 | $dbm = $this->getContext()->getDatabaseManager(); |
| 482 | 482 | $dbname = $this->getResourceName(); |
| 483 | - $conn = $dbm->acquire( $dbname ); |
|
| 483 | + $conn = $dbm->acquire($dbname); |
|
| 484 | 484 | $map = []; |
| 485 | 485 | |
| 486 | 486 | try |
@@ -488,32 +488,32 @@ discard block |
||
| 488 | 488 | $level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL; |
| 489 | 489 | $cfgPathSearch = 'mshop/customer/manager/laravel/search'; |
| 490 | 490 | $cfgPathCount = 'mshop/customer/manager/laravel/count'; |
| 491 | - $required = array( 'customer' ); |
|
| 491 | + $required = array('customer'); |
|
| 492 | 492 | |
| 493 | - $results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level ); |
|
| 494 | - while( ( $row = $results->fetch() ) !== false ) { |
|
| 495 | - $map[ $row['customer.id'] ] = $row; |
|
| 493 | + $results = $this->searchItemsBase($conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level); |
|
| 494 | + while (($row = $results->fetch()) !== false) { |
|
| 495 | + $map[$row['customer.id']] = $row; |
|
| 496 | 496 | } |
| 497 | 497 | |
| 498 | - $dbm->release( $conn, $dbname ); |
|
| 498 | + $dbm->release($conn, $dbname); |
|
| 499 | 499 | } |
| 500 | - catch( \Exception $e ) |
|
| 500 | + catch (\Exception $e) |
|
| 501 | 501 | { |
| 502 | - $dbm->release( $conn, $dbname ); |
|
| 502 | + $dbm->release($conn, $dbname); |
|
| 503 | 503 | throw $e; |
| 504 | 504 | } |
| 505 | 505 | |
| 506 | 506 | $addrItems = []; |
| 507 | - if( in_array( 'customer/address', $ref, true ) ) { |
|
| 508 | - $addrItems = $this->getAddressItems( array_keys( $map ), 'customer' ); |
|
| 507 | + if (in_array('customer/address', $ref, true)) { |
|
| 508 | + $addrItems = $this->getAddressItems(array_keys($map), 'customer'); |
|
| 509 | 509 | } |
| 510 | 510 | |
| 511 | 511 | $propItems = []; |
| 512 | - if( in_array( 'customer/property', $ref, true ) ) { |
|
| 513 | - $propItems = $this->getPropertyItems( array_keys( $map ), 'customer' ); |
|
| 512 | + if (in_array('customer/property', $ref, true)) { |
|
| 513 | + $propItems = $this->getPropertyItems(array_keys($map), 'customer'); |
|
| 514 | 514 | } |
| 515 | 515 | |
| 516 | - return $this->buildItems( $map, $ref, 'customer', $addrItems, $propItems ); |
|
| 516 | + return $this->buildItems($map, $ref, 'customer', $addrItems, $propItems); |
|
| 517 | 517 | } |
| 518 | 518 | |
| 519 | 519 | |
@@ -524,8 +524,8 @@ discard block |
||
| 524 | 524 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
| 525 | 525 | * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
| 526 | 526 | */ |
| 527 | - public function getSubManager( $manager, $name = null ) |
|
| 527 | + public function getSubManager($manager, $name = null) |
|
| 528 | 528 | { |
| 529 | - return $this->getSubManagerBase( 'customer', $manager, ( $name === null ? 'Laravel' : $name ) ); |
|
| 529 | + return $this->getSubManagerBase('customer', $manager, ($name === null ? 'Laravel' : $name)); |
|
| 530 | 530 | } |
| 531 | 531 | } |