@@ -242,11 +242,11 @@ discard block |
||
242 | 242 | * |
243 | 243 | * @param array $siteids List of IDs for sites whose entries should be deleted |
244 | 244 | */ |
245 | - public function cleanup( array $siteids ) |
|
245 | + public function cleanup(array $siteids) |
|
246 | 246 | { |
247 | 247 | $path = 'mshop/customer/manager/submanagers'; |
248 | - foreach( $this->getContext()->getConfig()->get( $path, array( 'address', 'lists' ) ) as $domain ) { |
|
249 | - $this->getSubManager( $domain )->cleanup( $siteids ); |
|
248 | + foreach ($this->getContext()->getConfig()->get($path, array('address', 'lists')) as $domain) { |
|
249 | + $this->getSubManager($domain)->cleanup($siteids); |
|
250 | 250 | } |
251 | 251 | } |
252 | 252 | |
@@ -256,10 +256,10 @@ discard block |
||
256 | 256 | * |
257 | 257 | * @param array $ids List of IDs |
258 | 258 | */ |
259 | - public function deleteItems( array $ids ) |
|
259 | + public function deleteItems(array $ids) |
|
260 | 260 | { |
261 | 261 | $path = 'mshop/customer/manager/fosuser/delete'; |
262 | - $this->deleteItemsBase( $ids, $path, false ); |
|
262 | + $this->deleteItemsBase($ids, $path, false); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | |
@@ -269,11 +269,11 @@ discard block |
||
269 | 269 | * @param boolean $withsub Return also attributes of sub-managers if true |
270 | 270 | * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
271 | 271 | */ |
272 | - public function getSearchAttributes( $withsub = true ) |
|
272 | + public function getSearchAttributes($withsub = true) |
|
273 | 273 | { |
274 | 274 | $path = 'mshop/customer/manager/submanagers'; |
275 | 275 | |
276 | - return $this->getSearchAttributesBase( $this->searchConfig, $path, array( 'address', 'lists' ), $withsub ); |
|
276 | + return $this->getSearchAttributesBase($this->searchConfig, $path, array('address', 'lists'), $withsub); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | |
@@ -294,27 +294,27 @@ discard block |
||
294 | 294 | * @param \Aimeos\MShop\Customer\Item\Iface $item Customer item object |
295 | 295 | * @param boolean $fetch True if the new ID should be returned in the item |
296 | 296 | */ |
297 | - public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true ) |
|
297 | + public function saveItem(\Aimeos\MShop\Common\Item\Iface $item, $fetch = true) |
|
298 | 298 | { |
299 | 299 | $iface = '\\Aimeos\\MShop\\Customer\\Item\\Iface'; |
300 | - if( !( $item instanceof $iface ) ) { |
|
301 | - throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Object is not of required type "%1$s"', $iface ) ); |
|
300 | + if (!($item instanceof $iface)) { |
|
301 | + throw new \Aimeos\MShop\Customer\Exception(sprintf('Object is not of required type "%1$s"', $iface)); |
|
302 | 302 | } |
303 | 303 | |
304 | - if( !$item->isModified() ) { return; } |
|
304 | + if (!$item->isModified()) { return; } |
|
305 | 305 | |
306 | 306 | $context = $this->getContext(); |
307 | 307 | $dbm = $context->getDatabaseManager(); |
308 | 308 | $dbname = $this->getResourceName(); |
309 | - $conn = $dbm->acquire( $dbname ); |
|
309 | + $conn = $dbm->acquire($dbname); |
|
310 | 310 | |
311 | 311 | try |
312 | 312 | { |
313 | 313 | $id = $item->getId(); |
314 | - $date = date( 'Y-m-d H:i:s' ); |
|
314 | + $date = date('Y-m-d H:i:s'); |
|
315 | 315 | $billingAddress = $item->getPaymentAddress(); |
316 | 316 | |
317 | - if( $id === null ) |
|
317 | + if ($id === null) |
|
318 | 318 | { |
319 | 319 | /** mshop/customer/manager/fosuser/insert |
320 | 320 | * Inserts a new customer record into the database table |
@@ -378,49 +378,49 @@ discard block |
||
378 | 378 | $path = 'mshop/customer/manager/fosuser/update'; |
379 | 379 | } |
380 | 380 | |
381 | - $stmt = $this->getCachedStatement( $conn, $path ); |
|
382 | - |
|
383 | - $stmt->bind( 1, $item->getCode() ); // canonical username |
|
384 | - $stmt->bind( 2, $item->getCode() ); // username |
|
385 | - $stmt->bind( 3, $billingAddress->getCompany() ); |
|
386 | - $stmt->bind( 4, $billingAddress->getVatID() ); |
|
387 | - $stmt->bind( 5, $billingAddress->getSalutation() ); |
|
388 | - $stmt->bind( 6, $billingAddress->getTitle() ); |
|
389 | - $stmt->bind( 7, $billingAddress->getFirstname() ); |
|
390 | - $stmt->bind( 8, $billingAddress->getLastname() ); |
|
391 | - $stmt->bind( 9, $billingAddress->getAddress1() ); |
|
392 | - $stmt->bind( 10, $billingAddress->getAddress2() ); |
|
393 | - $stmt->bind( 11, $billingAddress->getAddress3() ); |
|
394 | - $stmt->bind( 12, $billingAddress->getPostal() ); |
|
395 | - $stmt->bind( 13, $billingAddress->getCity() ); |
|
396 | - $stmt->bind( 14, $billingAddress->getState() ); |
|
397 | - $stmt->bind( 15, $billingAddress->getCountryId() ); |
|
398 | - $stmt->bind( 16, $billingAddress->getLanguageId() ); |
|
399 | - $stmt->bind( 17, $billingAddress->getTelephone() ); |
|
400 | - $stmt->bind( 18, $billingAddress->getEmail() ); |
|
401 | - $stmt->bind( 19, $billingAddress->getEmail() ); |
|
402 | - $stmt->bind( 20, $billingAddress->getTelefax() ); |
|
403 | - $stmt->bind( 21, $billingAddress->getWebsite() ); |
|
404 | - $stmt->bind( 22, $billingAddress->getLongitude() ); |
|
405 | - $stmt->bind( 23, $billingAddress->getLatitude() ); |
|
406 | - $stmt->bind( 24, $item->getBirthday() ); |
|
407 | - $stmt->bind( 25, $item->getStatus(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
408 | - $stmt->bind( 26, $item->getDateVerified() ); |
|
409 | - $stmt->bind( 27, $item->getPassword() ); |
|
410 | - $stmt->bind( 28, $date ); // Modification time |
|
411 | - $stmt->bind( 29, $context->getEditor() ); |
|
412 | - $stmt->bind( 30, serialize( $item->getRoles() ) ); |
|
413 | - |
|
414 | - if( $id !== null ) { |
|
415 | - $stmt->bind( 31, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
416 | - $item->setId( $id ); |
|
381 | + $stmt = $this->getCachedStatement($conn, $path); |
|
382 | + |
|
383 | + $stmt->bind(1, $item->getCode()); // canonical username |
|
384 | + $stmt->bind(2, $item->getCode()); // username |
|
385 | + $stmt->bind(3, $billingAddress->getCompany()); |
|
386 | + $stmt->bind(4, $billingAddress->getVatID()); |
|
387 | + $stmt->bind(5, $billingAddress->getSalutation()); |
|
388 | + $stmt->bind(6, $billingAddress->getTitle()); |
|
389 | + $stmt->bind(7, $billingAddress->getFirstname()); |
|
390 | + $stmt->bind(8, $billingAddress->getLastname()); |
|
391 | + $stmt->bind(9, $billingAddress->getAddress1()); |
|
392 | + $stmt->bind(10, $billingAddress->getAddress2()); |
|
393 | + $stmt->bind(11, $billingAddress->getAddress3()); |
|
394 | + $stmt->bind(12, $billingAddress->getPostal()); |
|
395 | + $stmt->bind(13, $billingAddress->getCity()); |
|
396 | + $stmt->bind(14, $billingAddress->getState()); |
|
397 | + $stmt->bind(15, $billingAddress->getCountryId()); |
|
398 | + $stmt->bind(16, $billingAddress->getLanguageId()); |
|
399 | + $stmt->bind(17, $billingAddress->getTelephone()); |
|
400 | + $stmt->bind(18, $billingAddress->getEmail()); |
|
401 | + $stmt->bind(19, $billingAddress->getEmail()); |
|
402 | + $stmt->bind(20, $billingAddress->getTelefax()); |
|
403 | + $stmt->bind(21, $billingAddress->getWebsite()); |
|
404 | + $stmt->bind(22, $billingAddress->getLongitude()); |
|
405 | + $stmt->bind(23, $billingAddress->getLatitude()); |
|
406 | + $stmt->bind(24, $item->getBirthday()); |
|
407 | + $stmt->bind(25, $item->getStatus(), \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
408 | + $stmt->bind(26, $item->getDateVerified()); |
|
409 | + $stmt->bind(27, $item->getPassword()); |
|
410 | + $stmt->bind(28, $date); // Modification time |
|
411 | + $stmt->bind(29, $context->getEditor()); |
|
412 | + $stmt->bind(30, serialize($item->getRoles())); |
|
413 | + |
|
414 | + if ($id !== null) { |
|
415 | + $stmt->bind(31, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
416 | + $item->setId($id); |
|
417 | 417 | } else { |
418 | - $stmt->bind( 31, $date ); // Creation time |
|
418 | + $stmt->bind(31, $date); // Creation time |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | $stmt->execute()->finish(); |
422 | 422 | |
423 | - if( $id === null && $fetch === true ) |
|
423 | + if ($id === null && $fetch === true) |
|
424 | 424 | { |
425 | 425 | /** mshop/customer/manager/fosuser/newid |
426 | 426 | * Retrieves the ID generated by the database when inserting a new record |
@@ -453,14 +453,14 @@ discard block |
||
453 | 453 | * @see mshop/customer/manager/fosuser/count |
454 | 454 | */ |
455 | 455 | $path = 'mshop/customer/manager/fosuser/newid'; |
456 | - $item->setId( $this->newId( $conn, $path ) ); |
|
456 | + $item->setId($this->newId($conn, $path)); |
|
457 | 457 | } |
458 | 458 | |
459 | - $dbm->release( $conn, $dbname ); |
|
459 | + $dbm->release($conn, $dbname); |
|
460 | 460 | } |
461 | - catch( \Exception $e ) |
|
461 | + catch (\Exception $e) |
|
462 | 462 | { |
463 | - $dbm->release( $conn, $dbname ); |
|
463 | + $dbm->release($conn, $dbname); |
|
464 | 464 | throw $e; |
465 | 465 | } |
466 | 466 | } |
@@ -474,11 +474,11 @@ discard block |
||
474 | 474 | * @return array List of items implementing \Aimeos\MShop\Customer\Item\Iface |
475 | 475 | * @throws \Aimeos\MShop\Customer\Exception If creating items failed |
476 | 476 | */ |
477 | - public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = array(), &$total = null ) |
|
477 | + public function searchItems(\Aimeos\MW\Criteria\Iface $search, array $ref = array(), &$total = null) |
|
478 | 478 | { |
479 | 479 | $dbm = $this->getContext()->getDatabaseManager(); |
480 | 480 | $dbname = $this->getResourceName(); |
481 | - $conn = $dbm->acquire( $dbname ); |
|
481 | + $conn = $dbm->acquire($dbname); |
|
482 | 482 | $map = array(); |
483 | 483 | |
484 | 484 | try |
@@ -486,22 +486,22 @@ discard block |
||
486 | 486 | $level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL; |
487 | 487 | $cfgPathSearch = 'mshop/customer/manager/fosuser/search'; |
488 | 488 | $cfgPathCount = 'mshop/customer/manager/fosuser/count'; |
489 | - $required = array( 'customer' ); |
|
489 | + $required = array('customer'); |
|
490 | 490 | |
491 | - $results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level ); |
|
492 | - while( ( $row = $results->fetch() ) !== false ) { |
|
493 | - $map[ $row['customer.id'] ] = $row; |
|
491 | + $results = $this->searchItemsBase($conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level); |
|
492 | + while (($row = $results->fetch()) !== false) { |
|
493 | + $map[$row['customer.id']] = $row; |
|
494 | 494 | } |
495 | 495 | |
496 | - $dbm->release( $conn, $dbname ); |
|
496 | + $dbm->release($conn, $dbname); |
|
497 | 497 | } |
498 | - catch( \Exception $e ) |
|
498 | + catch (\Exception $e) |
|
499 | 499 | { |
500 | - $dbm->release( $conn, $dbname ); |
|
500 | + $dbm->release($conn, $dbname); |
|
501 | 501 | throw $e; |
502 | 502 | } |
503 | 503 | |
504 | - return $this->buildItems( $map, $ref, 'customer' ); |
|
504 | + return $this->buildItems($map, $ref, 'customer'); |
|
505 | 505 | } |
506 | 506 | |
507 | 507 | |
@@ -512,9 +512,9 @@ discard block |
||
512 | 512 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
513 | 513 | * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
514 | 514 | */ |
515 | - public function getSubManager( $manager, $name = null ) |
|
515 | + public function getSubManager($manager, $name = null) |
|
516 | 516 | { |
517 | - return $this->getSubManagerBase( 'customer', $manager, ( $name === null ? 'FosUser' : $name ) ); |
|
517 | + return $this->getSubManagerBase('customer', $manager, ($name === null ? 'FosUser' : $name)); |
|
518 | 518 | } |
519 | 519 | |
520 | 520 | |
@@ -526,19 +526,19 @@ discard block |
||
526 | 526 | * @param array $refItems Items referenced by the customer item via the list items |
527 | 527 | * @return \Aimeos\MShop\Customer\Item\Iface New customer item |
528 | 528 | */ |
529 | - protected function createItemBase( array $values = array(), array $listItems = array(), array $refItems = array() ) |
|
529 | + protected function createItemBase(array $values = array(), array $listItems = array(), array $refItems = array()) |
|
530 | 530 | { |
531 | - if( !isset( $this->addressManager ) ) { |
|
532 | - $this->addressManager = $this->getSubManager( 'address' ); |
|
531 | + if (!isset($this->addressManager)) { |
|
532 | + $this->addressManager = $this->getSubManager('address'); |
|
533 | 533 | } |
534 | 534 | |
535 | - if( isset( $values['roles'] ) ) { |
|
536 | - $values['roles'] = unserialize( $values['roles'] ); |
|
535 | + if (isset($values['roles'])) { |
|
536 | + $values['roles'] = unserialize($values['roles']); |
|
537 | 537 | } |
538 | 538 | |
539 | 539 | $helper = $this->getPasswordHelper(); |
540 | 540 | $address = $this->addressManager->createItem(); |
541 | 541 | |
542 | - return new \Aimeos\MShop\Customer\Item\FosUser( $address, $values, $listItems, $refItems, $helper ); |
|
542 | + return new \Aimeos\MShop\Customer\Item\FosUser($address, $values, $listItems, $refItems, $helper); |
|
543 | 543 | } |
544 | 544 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | 'customer.address.position' => 1, |
31 | 31 | ); |
32 | 32 | |
33 | - $address = new \Aimeos\MShop\Common\Item\Address\Standard( 'common.address.', $addressValues ); |
|
33 | + $address = new \Aimeos\MShop\Common\Item\Address\Standard('common.address.', $addressValues); |
|
34 | 34 | |
35 | 35 | $values = array( |
36 | 36 | 'customer.id' => 541, |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | 'customer.mtime'=> '2010-01-05 00:00:05', |
63 | 63 | 'customer.ctime'=> '2010-01-01 00:00:00', |
64 | 64 | 'customer.editor' => 'unitTestUser', |
65 | - 'roles' => array( 'ROLE_ADMIN' ), |
|
65 | + 'roles' => array('ROLE_ADMIN'), |
|
66 | 66 | ); |
67 | 67 | |
68 | - $this->object = new \Aimeos\MShop\Customer\Item\FosUser( $address, $values ); |
|
68 | + $this->object = new \Aimeos\MShop\Customer\Item\FosUser($address, $values); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -76,23 +76,23 @@ discard block |
||
76 | 76 | */ |
77 | 77 | protected function tearDown() |
78 | 78 | { |
79 | - unset( $this->object ); |
|
79 | + unset($this->object); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | public function testGetRoles() |
83 | 83 | { |
84 | - $this->assertEquals( array( 'ROLE_ADMIN' ), $this->object->getRoles() ); |
|
84 | + $this->assertEquals(array('ROLE_ADMIN'), $this->object->getRoles()); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | public function testSetRoles() |
88 | 88 | { |
89 | - $this->object->setRoles( array( 'ROLE_USER' ) ); |
|
90 | - $this->assertTrue( $this->object->isModified() ); |
|
91 | - $this->assertEquals( array( 'ROLE_USER' ), $this->object->getRoles() ); |
|
89 | + $this->object->setRoles(array('ROLE_USER')); |
|
90 | + $this->assertTrue($this->object->isModified()); |
|
91 | + $this->assertEquals(array('ROLE_USER'), $this->object->getRoles()); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | public function testIsModified() |
95 | 95 | { |
96 | - $this->assertFalse( $this->object->isModified() ); |
|
96 | + $this->assertFalse($this->object->isModified()); |
|
97 | 97 | } |
98 | 98 | } |