@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | public function getPreDependencies() |
| 23 | 23 | { |
| 24 | - return array( 'TablesCreateFosUser' ); |
|
| 24 | + return array('TablesCreateFosUser'); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | |
@@ -30,36 +30,36 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function migrate() |
| 32 | 32 | { |
| 33 | - \Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\MShop\\Context\\Item\\Iface', $this->additional ); |
|
| 33 | + \Aimeos\MW\Common\Base::checkClass('\\Aimeos\\MShop\\Context\\Item\\Iface', $this->additional); |
|
| 34 | 34 | |
| 35 | - $this->msg( 'Adding Fos user bundle customer test data', 0 ); |
|
| 35 | + $this->msg('Adding Fos user bundle customer test data', 0); |
|
| 36 | 36 | |
| 37 | 37 | $parentIds = []; |
| 38 | 38 | $ds = DIRECTORY_SEPARATOR; |
| 39 | - $this->additional->setEditor( 'ai-fosuser:unittest' ); |
|
| 39 | + $this->additional->setEditor('ai-fosuser:unittest'); |
|
| 40 | 40 | $path = __DIR__ . $ds . 'data' . $ds . 'customer.php'; |
| 41 | 41 | |
| 42 | - if( ( $testdata = include( $path ) ) === false ){ |
|
| 43 | - throw new \Aimeos\MShop\Exception( sprintf( 'No file "%1$s" found for customer domain', $path ) ); |
|
| 42 | + if (($testdata = include($path)) === false) { |
|
| 43 | + throw new \Aimeos\MShop\Exception(sprintf('No file "%1$s" found for customer domain', $path)); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | |
| 47 | - $customerManager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $this->additional, 'FosUser' ); |
|
| 48 | - $customerAddressManager = $customerManager->getSubManager( 'address', 'FosUser' ); |
|
| 47 | + $customerManager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->additional, 'FosUser'); |
|
| 48 | + $customerAddressManager = $customerManager->getSubManager('address', 'FosUser'); |
|
| 49 | 49 | |
| 50 | 50 | $search = $customerManager->createSearch(); |
| 51 | - $search->setConditions( $search->compare( '==', 'customer.code', array( 'UTC001', 'UTC002', 'UTC003' ) ) ); |
|
| 52 | - $items = $customerManager->searchItems( $search ); |
|
| 51 | + $search->setConditions($search->compare('==', 'customer.code', array('UTC001', 'UTC002', 'UTC003'))); |
|
| 52 | + $items = $customerManager->searchItems($search); |
|
| 53 | 53 | |
| 54 | 54 | $this->conn->begin(); |
| 55 | 55 | |
| 56 | - $customerManager->deleteItems( array_keys( $items ) ); |
|
| 57 | - $parentIds = $this->addCustomerData( $testdata, $customerManager, $customerAddressManager->createItem() ); |
|
| 58 | - $this->addCustomerAddressData( $testdata, $customerAddressManager, $parentIds ); |
|
| 56 | + $customerManager->deleteItems(array_keys($items)); |
|
| 57 | + $parentIds = $this->addCustomerData($testdata, $customerManager, $customerAddressManager->createItem()); |
|
| 58 | + $this->addCustomerAddressData($testdata, $customerAddressManager, $parentIds); |
|
| 59 | 59 | |
| 60 | 60 | $this->conn->commit(); |
| 61 | 61 | |
| 62 | 62 | |
| 63 | - $this->status( 'done' ); |
|
| 63 | + $this->status('done'); |
|
| 64 | 64 | } |
| 65 | 65 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public function getPreDependencies() |
| 24 | 24 | { |
| 25 | - return array( 'TablesCreateFosUser', 'CustomerAddFosUserTestData', 'LocaleAddTestData', 'TextAddTestData' ); |
|
| 25 | + return array('TablesCreateFosUser', 'CustomerAddFosUserTestData', 'LocaleAddTestData', 'TextAddTestData'); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | |
@@ -31,27 +31,27 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | public function migrate() |
| 33 | 33 | { |
| 34 | - \Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\MShop\\Context\\Item\\Iface', $this->additional ); |
|
| 34 | + \Aimeos\MW\Common\Base::checkClass('\\Aimeos\\MShop\\Context\\Item\\Iface', $this->additional); |
|
| 35 | 35 | |
| 36 | - $this->msg( 'Adding customer-list Fos user bundle test data', 0 ); |
|
| 37 | - $this->additional->setEditor( 'ai-fosuser:unittest' ); |
|
| 36 | + $this->msg('Adding customer-list Fos user bundle test data', 0); |
|
| 37 | + $this->additional->setEditor('ai-fosuser:unittest'); |
|
| 38 | 38 | |
| 39 | 39 | $ds = DIRECTORY_SEPARATOR; |
| 40 | - $path = dirname( __FILE__ ) . $ds . 'data' . $ds . 'customer-list.php'; |
|
| 40 | + $path = dirname(__FILE__) . $ds . 'data' . $ds . 'customer-list.php'; |
|
| 41 | 41 | |
| 42 | - if( ( $testdata = include( $path ) ) === false ){ |
|
| 43 | - throw new \Aimeos\MShop\Exception( sprintf( 'No file "%1$s" found for customer list domain', $path ) ); |
|
| 42 | + if (($testdata = include($path)) === false) { |
|
| 43 | + throw new \Aimeos\MShop\Exception(sprintf('No file "%1$s" found for customer list domain', $path)); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | $refKeys = []; |
| 47 | - foreach( $testdata['customer/lists'] as $dataset ) { |
|
| 48 | - $refKeys[ $dataset['domain'] ][] = $dataset['refid']; |
|
| 47 | + foreach ($testdata['customer/lists'] as $dataset) { |
|
| 48 | + $refKeys[$dataset['domain']][] = $dataset['refid']; |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | $refIds = []; |
| 52 | - $refIds['text'] = $this->getTextData( $refKeys['text'] ); |
|
| 53 | - $this->addCustomerListData( $testdata, $refIds, 'FosUser' ); |
|
| 52 | + $refIds['text'] = $this->getTextData($refKeys['text']); |
|
| 53 | + $this->addCustomerListData($testdata, $refIds, 'FosUser'); |
|
| 54 | 54 | |
| 55 | - $this->status( 'done' ); |
|
| 55 | + $this->status('done'); |
|
| 56 | 56 | } |
| 57 | 57 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | public function getPreDependencies() |
| 25 | 25 | { |
| 26 | - return array( 'TablesCreateFosUser', 'CustomerAddFosUserTestData', 'LocaleAddTestData' ); |
|
| 26 | + return array('TablesCreateFosUser', 'CustomerAddFosUserTestData', 'LocaleAddTestData'); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | |
@@ -32,20 +32,20 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public function migrate() |
| 34 | 34 | { |
| 35 | - \Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\MShop\\Context\\Item\\Iface', $this->additional ); |
|
| 35 | + \Aimeos\MW\Common\Base::checkClass('\\Aimeos\\MShop\\Context\\Item\\Iface', $this->additional); |
|
| 36 | 36 | |
| 37 | - $this->msg( 'Adding customer property Fos user bundle test data', 0 ); |
|
| 38 | - $this->additional->setEditor( 'ai-fosuser:unittest' ); |
|
| 37 | + $this->msg('Adding customer property Fos user bundle test data', 0); |
|
| 38 | + $this->additional->setEditor('ai-fosuser:unittest'); |
|
| 39 | 39 | |
| 40 | 40 | $ds = DIRECTORY_SEPARATOR; |
| 41 | 41 | $path = __DIR__ . $ds . 'data' . $ds . 'customer-property.php'; |
| 42 | 42 | |
| 43 | - if( ( $testdata = include( $path ) ) == false ) { |
|
| 44 | - throw new \Aimeos\MShop\Exception( sprintf( 'No file "%1$s" found for customer domain', $path ) ); |
|
| 43 | + if (($testdata = include($path)) == false) { |
|
| 44 | + throw new \Aimeos\MShop\Exception(sprintf('No file "%1$s" found for customer domain', $path)); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - $this->addCustomerPropertyData( $testdata, 'FosUser' ); |
|
| 47 | + $this->addCustomerPropertyData($testdata, 'FosUser'); |
|
| 48 | 48 | |
| 49 | - $this->status( 'done' ); |
|
| 49 | + $this->status('done'); |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | \ No newline at end of file |
@@ -20,91 +20,91 @@ discard block |
||
| 20 | 20 | $context = \TestHelper::getContext(); |
| 21 | 21 | $this->editor = $context->getEditor(); |
| 22 | 22 | |
| 23 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context, 'FosUser' ); |
|
| 24 | - $this->object = $manager->getSubManager( 'property', 'FosUser' ); |
|
| 23 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context, 'FosUser'); |
|
| 24 | + $this->object = $manager->getSubManager('property', 'FosUser'); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | protected function tearDown() |
| 29 | 29 | { |
| 30 | - unset( $this->object ); |
|
| 30 | + unset($this->object); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | public function testCleanup() |
| 35 | 35 | { |
| 36 | - $this->object->cleanup( array( -1 ) ); |
|
| 36 | + $this->object->cleanup(array( -1 )); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | public function testCreateItem() |
| 41 | 41 | { |
| 42 | 42 | $item = $this->object->createItem(); |
| 43 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Property\\Iface', $item ); |
|
| 43 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Property\\Iface', $item); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | |
| 47 | 47 | public function testSaveInvalid() |
| 48 | 48 | { |
| 49 | - $this->setExpectedException( '\Aimeos\MW\Common\Exception' ); |
|
| 50 | - $this->object->saveItem( new \Aimeos\MShop\Locale\Item\Standard() ); |
|
| 49 | + $this->setExpectedException('\Aimeos\MW\Common\Exception'); |
|
| 50 | + $this->object->saveItem(new \Aimeos\MShop\Locale\Item\Standard()); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | public function testSaveUpdateDeleteItem() |
| 55 | 55 | { |
| 56 | 56 | $search = $this->object->createSearch(); |
| 57 | - $search->setConditions( $search->compare( '==', 'customer.property.editor', $this->editor ) ); |
|
| 58 | - $results = $this->object->searchItems( $search ); |
|
| 57 | + $search->setConditions($search->compare('==', 'customer.property.editor', $this->editor)); |
|
| 58 | + $results = $this->object->searchItems($search); |
|
| 59 | 59 | |
| 60 | - if( ( $item = reset($results) ) === false ) { |
|
| 61 | - throw new \RuntimeException( 'No property item found' ); |
|
| 60 | + if (($item = reset($results)) === false) { |
|
| 61 | + throw new \RuntimeException('No property item found'); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | $item->setId(null); |
| 65 | - $item->setLanguageId( 'en' ); |
|
| 66 | - $resultSaved = $this->object->saveItem( $item ); |
|
| 67 | - $itemSaved = $this->object->getItem( $item->getId() ); |
|
| 65 | + $item->setLanguageId('en'); |
|
| 66 | + $resultSaved = $this->object->saveItem($item); |
|
| 67 | + $itemSaved = $this->object->getItem($item->getId()); |
|
| 68 | 68 | |
| 69 | 69 | $itemExp = clone $itemSaved; |
| 70 | - $itemExp->setValue( 'unittest' ); |
|
| 71 | - $resultUpd = $this->object->saveItem( $itemExp ); |
|
| 72 | - $itemUpd = $this->object->getItem( $itemExp->getId() ); |
|
| 70 | + $itemExp->setValue('unittest'); |
|
| 71 | + $resultUpd = $this->object->saveItem($itemExp); |
|
| 72 | + $itemUpd = $this->object->getItem($itemExp->getId()); |
|
| 73 | 73 | |
| 74 | - $this->object->deleteItem( $itemSaved->getId() ); |
|
| 74 | + $this->object->deleteItem($itemSaved->getId()); |
|
| 75 | 75 | |
| 76 | 76 | $context = \TestHelper::getContext(); |
| 77 | 77 | |
| 78 | - $this->assertTrue( $item->getId() !== null ); |
|
| 79 | - $this->assertTrue( $itemSaved->getType() !== null ); |
|
| 80 | - $this->assertEquals( $item->getId(), $itemSaved->getId() ); |
|
| 81 | - $this->assertEquals( $item->getParentId(), $itemSaved->getParentId() ); |
|
| 82 | - $this->assertEquals( $item->getSiteId(), $itemSaved->getSiteId() ); |
|
| 83 | - $this->assertEquals( $item->getTypeId(), $itemSaved->getTypeId() ); |
|
| 84 | - $this->assertEquals( $item->getLanguageId(), $itemSaved->getLanguageId() ); |
|
| 85 | - $this->assertEquals( $item->getValue(), $itemSaved->getValue() ); |
|
| 86 | - |
|
| 87 | - $this->assertEquals( $context->getEditor(), $itemSaved->getEditor() ); |
|
| 88 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() ); |
|
| 89 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() ); |
|
| 90 | - |
|
| 91 | - $this->assertTrue( $itemUpd->getType() !== null ); |
|
| 92 | - $this->assertEquals( $itemExp->getId(), $itemUpd->getId() ); |
|
| 93 | - $this->assertEquals( $itemExp->getParentId(), $itemUpd->getParentId() ); |
|
| 94 | - $this->assertEquals( $itemExp->getSiteId(), $itemUpd->getSiteId() ); |
|
| 95 | - $this->assertEquals( $itemExp->getTypeId(), $itemUpd->getTypeId() ); |
|
| 96 | - $this->assertEquals( $itemExp->getLanguageId(), $itemUpd->getLanguageId() ); |
|
| 97 | - $this->assertEquals( $itemExp->getValue(), $itemUpd->getValue() ); |
|
| 98 | - |
|
| 99 | - $this->assertEquals( $context->getEditor(), $itemUpd->getEditor() ); |
|
| 100 | - $this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() ); |
|
| 101 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() ); |
|
| 102 | - |
|
| 103 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Iface', $resultSaved ); |
|
| 104 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Iface', $resultUpd ); |
|
| 105 | - |
|
| 106 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 107 | - $this->object->getItem( $itemSaved->getId() ); |
|
| 78 | + $this->assertTrue($item->getId() !== null); |
|
| 79 | + $this->assertTrue($itemSaved->getType() !== null); |
|
| 80 | + $this->assertEquals($item->getId(), $itemSaved->getId()); |
|
| 81 | + $this->assertEquals($item->getParentId(), $itemSaved->getParentId()); |
|
| 82 | + $this->assertEquals($item->getSiteId(), $itemSaved->getSiteId()); |
|
| 83 | + $this->assertEquals($item->getTypeId(), $itemSaved->getTypeId()); |
|
| 84 | + $this->assertEquals($item->getLanguageId(), $itemSaved->getLanguageId()); |
|
| 85 | + $this->assertEquals($item->getValue(), $itemSaved->getValue()); |
|
| 86 | + |
|
| 87 | + $this->assertEquals($context->getEditor(), $itemSaved->getEditor()); |
|
| 88 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated()); |
|
| 89 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified()); |
|
| 90 | + |
|
| 91 | + $this->assertTrue($itemUpd->getType() !== null); |
|
| 92 | + $this->assertEquals($itemExp->getId(), $itemUpd->getId()); |
|
| 93 | + $this->assertEquals($itemExp->getParentId(), $itemUpd->getParentId()); |
|
| 94 | + $this->assertEquals($itemExp->getSiteId(), $itemUpd->getSiteId()); |
|
| 95 | + $this->assertEquals($itemExp->getTypeId(), $itemUpd->getTypeId()); |
|
| 96 | + $this->assertEquals($itemExp->getLanguageId(), $itemUpd->getLanguageId()); |
|
| 97 | + $this->assertEquals($itemExp->getValue(), $itemUpd->getValue()); |
|
| 98 | + |
|
| 99 | + $this->assertEquals($context->getEditor(), $itemUpd->getEditor()); |
|
| 100 | + $this->assertEquals($itemExp->getTimeCreated(), $itemUpd->getTimeCreated()); |
|
| 101 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified()); |
|
| 102 | + |
|
| 103 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Iface', $resultSaved); |
|
| 104 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Iface', $resultUpd); |
|
| 105 | + |
|
| 106 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
| 107 | + $this->object->getItem($itemSaved->getId()); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | |
@@ -112,19 +112,19 @@ discard block |
||
| 112 | 112 | { |
| 113 | 113 | $search = $this->object->createSearch(); |
| 114 | 114 | $conditions = array( |
| 115 | - $search->compare( '~=', 'customer.property.value', '1'), |
|
| 116 | - $search->compare( '==', 'customer.property.editor', $this->editor ) |
|
| 115 | + $search->compare('~=', 'customer.property.value', '1'), |
|
| 116 | + $search->compare('==', 'customer.property.editor', $this->editor) |
|
| 117 | 117 | ); |
| 118 | - $search->setConditions( $search->combine( '&&', $conditions ) ); |
|
| 119 | - $results = $this->object->searchItems( $search ); |
|
| 118 | + $search->setConditions($search->combine('&&', $conditions)); |
|
| 119 | + $results = $this->object->searchItems($search); |
|
| 120 | 120 | |
| 121 | - if( ($expected = reset($results)) === false ) { |
|
| 122 | - throw new \RuntimeException( sprintf( 'No customer property item found for value "%1$s".', '1' ) ); |
|
| 121 | + if (($expected = reset($results)) === false) { |
|
| 122 | + throw new \RuntimeException(sprintf('No customer property item found for value "%1$s".', '1')); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - $actual = $this->object->getItem( $expected->getId() ); |
|
| 126 | - $this->assertNotEquals( '', $actual->getTypeName() ); |
|
| 127 | - $this->assertEquals( $expected, $actual ); |
|
| 125 | + $actual = $this->object->getItem($expected->getId()); |
|
| 126 | + $this->assertNotEquals('', $actual->getTypeName()); |
|
| 127 | + $this->assertEquals($expected, $actual); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | |
@@ -132,15 +132,15 @@ discard block |
||
| 132 | 132 | { |
| 133 | 133 | $result = $this->object->getResourceType(); |
| 134 | 134 | |
| 135 | - $this->assertContains( 'customer/property', $result ); |
|
| 136 | - $this->assertContains( 'customer/property/type', $result ); |
|
| 135 | + $this->assertContains('customer/property', $result); |
|
| 136 | + $this->assertContains('customer/property/type', $result); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | |
| 140 | 140 | public function testGetSearchAttributes() |
| 141 | 141 | { |
| 142 | - foreach( $this->object->getSearchAttributes() as $attribute ) { |
|
| 143 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute ); |
|
| 142 | + foreach ($this->object->getSearchAttributes() as $attribute) { |
|
| 143 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute); |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | |
@@ -151,51 +151,51 @@ discard block |
||
| 151 | 151 | $search = $this->object->createSearch(); |
| 152 | 152 | |
| 153 | 153 | $expr = []; |
| 154 | - $expr[] = $search->compare( '!=', 'customer.property.id', null ); |
|
| 155 | - $expr[] = $search->compare( '!=', 'customer.property.parentid', null ); |
|
| 156 | - $expr[] = $search->compare( '!=', 'customer.property.siteid', null ); |
|
| 157 | - $expr[] = $search->compare( '!=', 'customer.property.typeid', null ); |
|
| 158 | - $expr[] = $search->compare( '==', 'customer.property.languageid', null ); |
|
| 159 | - $expr[] = $search->compare( '==', 'customer.property.value', '1' ); |
|
| 160 | - $expr[] = $search->compare( '==', 'customer.property.editor', $this->editor ); |
|
| 161 | - |
|
| 162 | - $expr[] = $search->compare( '!=', 'customer.property.type.id', null ); |
|
| 163 | - $expr[] = $search->compare( '!=', 'customer.property.type.siteid', null ); |
|
| 164 | - $expr[] = $search->compare( '==', 'customer.property.type.domain', 'customer' ); |
|
| 165 | - $expr[] = $search->compare( '==', 'customer.property.type.code', 'newsletter' ); |
|
| 166 | - $expr[] = $search->compare( '>', 'customer.property.type.label', '' ); |
|
| 167 | - $expr[] = $search->compare( '==', 'customer.property.type.status', 1 ); |
|
| 168 | - $expr[] = $search->compare( '>=', 'customer.property.type.mtime', '1970-01-01 00:00:00' ); |
|
| 169 | - $expr[] = $search->compare( '>=', 'customer.property.type.ctime', '1970-01-01 00:00:00' ); |
|
| 170 | - $expr[] = $search->compare( '==', 'customer.property.type.editor', $this->editor ); |
|
| 171 | - |
|
| 172 | - $search->setConditions( $search->combine('&&', $expr) ); |
|
| 173 | - $results = $this->object->searchItems( $search, [], $total ); |
|
| 174 | - $this->assertEquals( 1, count( $results ) ); |
|
| 154 | + $expr[] = $search->compare('!=', 'customer.property.id', null); |
|
| 155 | + $expr[] = $search->compare('!=', 'customer.property.parentid', null); |
|
| 156 | + $expr[] = $search->compare('!=', 'customer.property.siteid', null); |
|
| 157 | + $expr[] = $search->compare('!=', 'customer.property.typeid', null); |
|
| 158 | + $expr[] = $search->compare('==', 'customer.property.languageid', null); |
|
| 159 | + $expr[] = $search->compare('==', 'customer.property.value', '1'); |
|
| 160 | + $expr[] = $search->compare('==', 'customer.property.editor', $this->editor); |
|
| 161 | + |
|
| 162 | + $expr[] = $search->compare('!=', 'customer.property.type.id', null); |
|
| 163 | + $expr[] = $search->compare('!=', 'customer.property.type.siteid', null); |
|
| 164 | + $expr[] = $search->compare('==', 'customer.property.type.domain', 'customer'); |
|
| 165 | + $expr[] = $search->compare('==', 'customer.property.type.code', 'newsletter'); |
|
| 166 | + $expr[] = $search->compare('>', 'customer.property.type.label', ''); |
|
| 167 | + $expr[] = $search->compare('==', 'customer.property.type.status', 1); |
|
| 168 | + $expr[] = $search->compare('>=', 'customer.property.type.mtime', '1970-01-01 00:00:00'); |
|
| 169 | + $expr[] = $search->compare('>=', 'customer.property.type.ctime', '1970-01-01 00:00:00'); |
|
| 170 | + $expr[] = $search->compare('==', 'customer.property.type.editor', $this->editor); |
|
| 171 | + |
|
| 172 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 173 | + $results = $this->object->searchItems($search, [], $total); |
|
| 174 | + $this->assertEquals(1, count($results)); |
|
| 175 | 175 | |
| 176 | 176 | |
| 177 | 177 | $search = $this->object->createSearch(); |
| 178 | 178 | $conditions = array( |
| 179 | - $search->compare( '=~', 'customer.property.type.code', 'newsletter' ), |
|
| 180 | - $search->compare( '==', 'customer.property.editor', $this->editor ) |
|
| 179 | + $search->compare('=~', 'customer.property.type.code', 'newsletter'), |
|
| 180 | + $search->compare('==', 'customer.property.editor', $this->editor) |
|
| 181 | 181 | ); |
| 182 | - $search->setConditions( $search->combine( '&&', $conditions ) ); |
|
| 182 | + $search->setConditions($search->combine('&&', $conditions)); |
|
| 183 | 183 | $search->setSlice(0, 1); |
| 184 | - $items = $this->object->searchItems( $search, [], $total ); |
|
| 184 | + $items = $this->object->searchItems($search, [], $total); |
|
| 185 | 185 | |
| 186 | - $this->assertEquals( 1, count( $items ) ); |
|
| 187 | - $this->assertEquals( 1, $total ); |
|
| 186 | + $this->assertEquals(1, count($items)); |
|
| 187 | + $this->assertEquals(1, $total); |
|
| 188 | 188 | |
| 189 | - foreach($items as $itemId => $item) { |
|
| 190 | - $this->assertEquals( $itemId, $item->getId() ); |
|
| 189 | + foreach ($items as $itemId => $item) { |
|
| 190 | + $this->assertEquals($itemId, $item->getId()); |
|
| 191 | 191 | } |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | |
| 195 | 195 | public function testGetSubManager() |
| 196 | 196 | { |
| 197 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type') ); |
|
| 198 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type', 'Standard') ); |
|
| 197 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type')); |
|
| 198 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type', 'Standard')); |
|
| 199 | 199 | |
| 200 | 200 | $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
| 201 | 201 | $this->object->getSubManager('unknown'); |
@@ -20,8 +20,8 @@ discard block |
||
| 20 | 20 | $context = \TestHelper::getContext(); |
| 21 | 21 | $this->editor = $context->getEditor(); |
| 22 | 22 | |
| 23 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context, 'FosUser' ); |
|
| 24 | - $this->object = $manager->getSubManager( 'property', 'FosUser' )->getSubManager( 'type', 'FosUser' ); |
|
| 23 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context, 'FosUser'); |
|
| 24 | + $this->object = $manager->getSubManager('property', 'FosUser')->getSubManager('type', 'FosUser'); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | |
@@ -33,13 +33,13 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | public function testCleanup() |
| 35 | 35 | { |
| 36 | - $this->object->cleanup( array( -1 ) ); |
|
| 36 | + $this->object->cleanup(array( -1 )); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | public function testCreateItem() |
| 41 | 41 | { |
| 42 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Type\\Iface', $this->object->createItem() ); |
|
| 42 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Type\\Iface', $this->object->createItem()); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | |
@@ -47,14 +47,14 @@ discard block |
||
| 47 | 47 | { |
| 48 | 48 | $result = $this->object->getResourceType(); |
| 49 | 49 | |
| 50 | - $this->assertContains( 'customer/property/type', $result ); |
|
| 50 | + $this->assertContains('customer/property/type', $result); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | public function testGetSearchAttributes() |
| 55 | 55 | { |
| 56 | - foreach( $this->object->getSearchAttributes() as $attribute ) { |
|
| 57 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute ); |
|
| 56 | + foreach ($this->object->getSearchAttributes() as $attribute) { |
|
| 57 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute); |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | |
@@ -63,82 +63,82 @@ discard block |
||
| 63 | 63 | { |
| 64 | 64 | $search = $this->object->createSearch(); |
| 65 | 65 | $conditions = array( |
| 66 | - $search->compare( '==', 'customer.property.type.code', 'newsletter' ), |
|
| 67 | - $search->compare( '==', 'customer.property.type.editor', $this->editor ) |
|
| 66 | + $search->compare('==', 'customer.property.type.code', 'newsletter'), |
|
| 67 | + $search->compare('==', 'customer.property.type.editor', $this->editor) |
|
| 68 | 68 | ); |
| 69 | - $search->setConditions( $search->combine( '&&', $conditions ) ); |
|
| 69 | + $search->setConditions($search->combine('&&', $conditions)); |
|
| 70 | 70 | |
| 71 | - $results = $this->object->searchItems( $search ); |
|
| 71 | + $results = $this->object->searchItems($search); |
|
| 72 | 72 | |
| 73 | - if( ($expected = reset($results) ) === false ) |
|
| 73 | + if (($expected = reset($results)) === false) |
|
| 74 | 74 | { |
| 75 | - throw new \RuntimeException( 'No property type item found.' ); |
|
| 75 | + throw new \RuntimeException('No property type item found.'); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - $actual = $this->object->getItem( $expected->getId() ); |
|
| 78 | + $actual = $this->object->getItem($expected->getId()); |
|
| 79 | 79 | |
| 80 | - $this->assertEquals( $expected, $actual ); |
|
| 80 | + $this->assertEquals($expected, $actual); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | |
| 84 | 84 | public function testSaveInvalid() |
| 85 | 85 | { |
| 86 | - $this->setExpectedException( '\Aimeos\MW\Common\Exception' ); |
|
| 87 | - $this->object->saveItem( new \Aimeos\MShop\Locale\Item\Standard() ); |
|
| 86 | + $this->setExpectedException('\Aimeos\MW\Common\Exception'); |
|
| 87 | + $this->object->saveItem(new \Aimeos\MShop\Locale\Item\Standard()); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | |
| 91 | 91 | public function testSaveUpdateDeleteItem() |
| 92 | 92 | { |
| 93 | 93 | $search = $this->object->createSearch(); |
| 94 | - $search->setConditions( $search->compare( '==', 'customer.property.type.editor', $this->editor ) ); |
|
| 94 | + $search->setConditions($search->compare('==', 'customer.property.type.editor', $this->editor)); |
|
| 95 | 95 | $results = $this->object->searchItems($search); |
| 96 | 96 | |
| 97 | - if( ( $item = reset($results) ) === false ) { |
|
| 98 | - throw new \RuntimeException( 'No type item found' ); |
|
| 97 | + if (($item = reset($results)) === false) { |
|
| 98 | + throw new \RuntimeException('No type item found'); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | $item->setId(null); |
| 102 | - $item->setCode( 'unitTestSave' ); |
|
| 103 | - $resultSaved = $this->object->saveItem( $item ); |
|
| 104 | - $itemSaved = $this->object->getItem( $item->getId() ); |
|
| 102 | + $item->setCode('unitTestSave'); |
|
| 103 | + $resultSaved = $this->object->saveItem($item); |
|
| 104 | + $itemSaved = $this->object->getItem($item->getId()); |
|
| 105 | 105 | |
| 106 | 106 | $itemExp = clone $itemSaved; |
| 107 | - $itemExp->setCode( 'unitTestSave2' ); |
|
| 108 | - $resultUpd = $this->object->saveItem( $itemExp ); |
|
| 109 | - $itemUpd = $this->object->getItem( $itemExp->getId() ); |
|
| 107 | + $itemExp->setCode('unitTestSave2'); |
|
| 108 | + $resultUpd = $this->object->saveItem($itemExp); |
|
| 109 | + $itemUpd = $this->object->getItem($itemExp->getId()); |
|
| 110 | 110 | |
| 111 | - $this->object->deleteItem( $itemSaved->getId() ); |
|
| 111 | + $this->object->deleteItem($itemSaved->getId()); |
|
| 112 | 112 | |
| 113 | 113 | |
| 114 | - $this->assertTrue( $item->getId() !== null ); |
|
| 115 | - $this->assertEquals( $item->getId(), $itemSaved->getId() ); |
|
| 116 | - $this->assertEquals( $item->getSiteId(), $itemSaved->getSiteId() ); |
|
| 117 | - $this->assertEquals( $item->getCode(), $itemSaved->getCode() ); |
|
| 118 | - $this->assertEquals( $item->getDomain(), $itemSaved->getDomain() ); |
|
| 119 | - $this->assertEquals( $item->getLabel(), $itemSaved->getLabel() ); |
|
| 120 | - $this->assertEquals( $item->getStatus(), $itemSaved->getStatus() ); |
|
| 114 | + $this->assertTrue($item->getId() !== null); |
|
| 115 | + $this->assertEquals($item->getId(), $itemSaved->getId()); |
|
| 116 | + $this->assertEquals($item->getSiteId(), $itemSaved->getSiteId()); |
|
| 117 | + $this->assertEquals($item->getCode(), $itemSaved->getCode()); |
|
| 118 | + $this->assertEquals($item->getDomain(), $itemSaved->getDomain()); |
|
| 119 | + $this->assertEquals($item->getLabel(), $itemSaved->getLabel()); |
|
| 120 | + $this->assertEquals($item->getStatus(), $itemSaved->getStatus()); |
|
| 121 | 121 | |
| 122 | - $this->assertEquals( $this->editor, $itemSaved->getEditor() ); |
|
| 123 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() ); |
|
| 124 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() ); |
|
| 122 | + $this->assertEquals($this->editor, $itemSaved->getEditor()); |
|
| 123 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated()); |
|
| 124 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified()); |
|
| 125 | 125 | |
| 126 | - $this->assertEquals( $itemExp->getId(), $itemUpd->getId() ); |
|
| 127 | - $this->assertEquals( $itemExp->getSiteId(), $itemUpd->getSiteId() ); |
|
| 128 | - $this->assertEquals( $itemExp->getCode(), $itemUpd->getCode() ); |
|
| 129 | - $this->assertEquals( $itemExp->getDomain(), $itemUpd->getDomain() ); |
|
| 130 | - $this->assertEquals( $itemExp->getLabel(), $itemUpd->getLabel() ); |
|
| 131 | - $this->assertEquals( $itemExp->getStatus(), $itemUpd->getStatus() ); |
|
| 126 | + $this->assertEquals($itemExp->getId(), $itemUpd->getId()); |
|
| 127 | + $this->assertEquals($itemExp->getSiteId(), $itemUpd->getSiteId()); |
|
| 128 | + $this->assertEquals($itemExp->getCode(), $itemUpd->getCode()); |
|
| 129 | + $this->assertEquals($itemExp->getDomain(), $itemUpd->getDomain()); |
|
| 130 | + $this->assertEquals($itemExp->getLabel(), $itemUpd->getLabel()); |
|
| 131 | + $this->assertEquals($itemExp->getStatus(), $itemUpd->getStatus()); |
|
| 132 | 132 | |
| 133 | - $this->assertEquals( $this->editor, $itemUpd->getEditor() ); |
|
| 134 | - $this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() ); |
|
| 135 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() ); |
|
| 133 | + $this->assertEquals($this->editor, $itemUpd->getEditor()); |
|
| 134 | + $this->assertEquals($itemExp->getTimeCreated(), $itemUpd->getTimeCreated()); |
|
| 135 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified()); |
|
| 136 | 136 | |
| 137 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Iface', $resultSaved ); |
|
| 138 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Iface', $resultUpd ); |
|
| 137 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Iface', $resultSaved); |
|
| 138 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Iface', $resultUpd); |
|
| 139 | 139 | |
| 140 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 141 | - $this->object->getItem( $itemSaved->getId() ); |
|
| 140 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
| 141 | + $this->object->getItem($itemSaved->getId()); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | |
@@ -148,36 +148,36 @@ discard block |
||
| 148 | 148 | $search = $this->object->createSearch(); |
| 149 | 149 | |
| 150 | 150 | $expr = []; |
| 151 | - $expr[] = $search->compare( '!=', 'customer.property.type.id', null ); |
|
| 152 | - $expr[] = $search->compare( '!=', 'customer.property.type.siteid', null ); |
|
| 153 | - $expr[] = $search->compare( '==', 'customer.property.type.domain', 'customer' ); |
|
| 154 | - $expr[] = $search->compare( '==', 'customer.property.type.code', 'newsletter' ); |
|
| 155 | - $expr[] = $search->compare( '>', 'customer.property.type.label', '' ); |
|
| 156 | - $expr[] = $search->compare( '==', 'customer.property.type.status', 1 ); |
|
| 157 | - $expr[] = $search->compare( '>=', 'customer.property.type.mtime', '1970-01-01 00:00:00' ); |
|
| 158 | - $expr[] = $search->compare( '>=', 'customer.property.type.ctime', '1970-01-01 00:00:00' ); |
|
| 159 | - $expr[] = $search->compare( '==', 'customer.property.type.editor', $this->editor ); |
|
| 151 | + $expr[] = $search->compare('!=', 'customer.property.type.id', null); |
|
| 152 | + $expr[] = $search->compare('!=', 'customer.property.type.siteid', null); |
|
| 153 | + $expr[] = $search->compare('==', 'customer.property.type.domain', 'customer'); |
|
| 154 | + $expr[] = $search->compare('==', 'customer.property.type.code', 'newsletter'); |
|
| 155 | + $expr[] = $search->compare('>', 'customer.property.type.label', ''); |
|
| 156 | + $expr[] = $search->compare('==', 'customer.property.type.status', 1); |
|
| 157 | + $expr[] = $search->compare('>=', 'customer.property.type.mtime', '1970-01-01 00:00:00'); |
|
| 158 | + $expr[] = $search->compare('>=', 'customer.property.type.ctime', '1970-01-01 00:00:00'); |
|
| 159 | + $expr[] = $search->compare('==', 'customer.property.type.editor', $this->editor); |
|
| 160 | 160 | |
| 161 | - $search->setConditions( $search->combine('&&', $expr) ); |
|
| 162 | - $results = $this->object->searchItems( $search, [], $total ); |
|
| 163 | - $this->assertEquals( 1, count( $results ) ); |
|
| 161 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 162 | + $results = $this->object->searchItems($search, [], $total); |
|
| 163 | + $this->assertEquals(1, count($results)); |
|
| 164 | 164 | |
| 165 | 165 | |
| 166 | 166 | $search = $this->object->createSearch(); |
| 167 | 167 | $conditions = array( |
| 168 | - $search->compare( '=~', 'customer.property.type.code', 'newsletter'), |
|
| 169 | - $search->compare( '==', 'customer.property.type.editor', $this->editor ) |
|
| 168 | + $search->compare('=~', 'customer.property.type.code', 'newsletter'), |
|
| 169 | + $search->compare('==', 'customer.property.type.editor', $this->editor) |
|
| 170 | 170 | ); |
| 171 | - $search->setConditions( $search->combine('&&', $conditions ) ); |
|
| 172 | - $search->setSortations( [$search->sort('-', 'customer.property.type.position' )] ); |
|
| 171 | + $search->setConditions($search->combine('&&', $conditions)); |
|
| 172 | + $search->setSortations([$search->sort('-', 'customer.property.type.position')]); |
|
| 173 | 173 | $search->setSlice(0, 1); |
| 174 | - $items = $this->object->searchItems( $search, [], $total); |
|
| 174 | + $items = $this->object->searchItems($search, [], $total); |
|
| 175 | 175 | |
| 176 | - $this->assertEquals( 1, count( $items ) ); |
|
| 177 | - $this->assertEquals( 1, $total ); |
|
| 176 | + $this->assertEquals(1, count($items)); |
|
| 177 | + $this->assertEquals(1, $total); |
|
| 178 | 178 | |
| 179 | - foreach($items as $itemId => $item) { |
|
| 180 | - $this->assertEquals( $itemId, $item->getId() ); |
|
| 179 | + foreach ($items as $itemId => $item) { |
|
| 180 | + $this->assertEquals($itemId, $item->getId()); |
|
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | |
@@ -243,13 +243,13 @@ discard block |
||
| 243 | 243 | * |
| 244 | 244 | * @param array $siteids List of IDs for sites whose entries should be deleted |
| 245 | 245 | */ |
| 246 | - public function cleanup( array $siteids ) |
|
| 246 | + public function cleanup(array $siteids) |
|
| 247 | 247 | { |
| 248 | 248 | $path = 'mshop/customer/manager/submanagers'; |
| 249 | 249 | $default = ['address', 'group', 'lists', 'property']; |
| 250 | 250 | |
| 251 | - foreach( $this->getContext()->getConfig()->get( $path, $default ) as $domain ) { |
|
| 252 | - $this->getObject()->getSubManager( $domain )->cleanup( $siteids ); |
|
| 251 | + foreach ($this->getContext()->getConfig()->get($path, $default) as $domain) { |
|
| 252 | + $this->getObject()->getSubManager($domain)->cleanup($siteids); |
|
| 253 | 253 | } |
| 254 | 254 | } |
| 255 | 255 | |
@@ -259,10 +259,10 @@ discard block |
||
| 259 | 259 | * |
| 260 | 260 | * @param array $ids List of IDs |
| 261 | 261 | */ |
| 262 | - public function deleteItems( array $ids ) |
|
| 262 | + public function deleteItems(array $ids) |
|
| 263 | 263 | { |
| 264 | 264 | $path = 'mshop/customer/manager/fosuser/delete'; |
| 265 | - $this->deleteItemsBase( $ids, $path, false ); |
|
| 265 | + $this->deleteItemsBase($ids, $path, false); |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | |
@@ -272,12 +272,12 @@ discard block |
||
| 272 | 272 | * @param boolean $withsub Return also attributes of sub-managers if true |
| 273 | 273 | * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
| 274 | 274 | */ |
| 275 | - public function getSearchAttributes( $withsub = true ) |
|
| 275 | + public function getSearchAttributes($withsub = true) |
|
| 276 | 276 | { |
| 277 | 277 | $path = 'mshop/customer/manager/submanagers'; |
| 278 | 278 | $default = ['address', 'group', 'lists', 'property']; |
| 279 | 279 | |
| 280 | - return $this->getSearchAttributesBase( $this->searchConfig, $path, $default, $withsub ); |
|
| 280 | + return $this->getSearchAttributesBase($this->searchConfig, $path, $default, $withsub); |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | |
@@ -288,29 +288,29 @@ discard block |
||
| 288 | 288 | * @param boolean $fetch True if the new ID should be returned in the item |
| 289 | 289 | * @return \Aimeos\MShop\Common\Item\Iface $item Updated item including the generated ID |
| 290 | 290 | */ |
| 291 | - public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true ) |
|
| 291 | + public function saveItem(\Aimeos\MShop\Common\Item\Iface $item, $fetch = true) |
|
| 292 | 292 | { |
| 293 | - self::checkClass( '\\Aimeos\\MShop\\Customer\\Item\\FosUser', $item ); |
|
| 293 | + self::checkClass('\\Aimeos\\MShop\\Customer\\Item\\FosUser', $item); |
|
| 294 | 294 | |
| 295 | - if( !$item->isModified() ) |
|
| 295 | + if (!$item->isModified()) |
|
| 296 | 296 | { |
| 297 | - $item = $this->savePropertyItems( $item, 'customer' ); |
|
| 298 | - $item = $this->saveAddressItems( $item, 'customer' ); |
|
| 299 | - return $this->saveListItems( $item, 'customer' ); |
|
| 297 | + $item = $this->savePropertyItems($item, 'customer'); |
|
| 298 | + $item = $this->saveAddressItems($item, 'customer'); |
|
| 299 | + return $this->saveListItems($item, 'customer'); |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | $context = $this->getContext(); |
| 303 | 303 | $dbm = $context->getDatabaseManager(); |
| 304 | 304 | $dbname = $this->getResourceName(); |
| 305 | - $conn = $dbm->acquire( $dbname ); |
|
| 305 | + $conn = $dbm->acquire($dbname); |
|
| 306 | 306 | |
| 307 | 307 | try |
| 308 | 308 | { |
| 309 | 309 | $id = $item->getId(); |
| 310 | - $date = date( 'Y-m-d H:i:s' ); |
|
| 310 | + $date = date('Y-m-d H:i:s'); |
|
| 311 | 311 | $billingAddress = $item->getPaymentAddress(); |
| 312 | 312 | |
| 313 | - if( $id === null ) |
|
| 313 | + if ($id === null) |
|
| 314 | 314 | { |
| 315 | 315 | /** mshop/customer/manager/fosuser/insert |
| 316 | 316 | * Inserts a new customer record into the database table |
@@ -374,51 +374,51 @@ discard block |
||
| 374 | 374 | $path = 'mshop/customer/manager/fosuser/update'; |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | - $stmt = $this->getCachedStatement( $conn, $path ); |
|
| 378 | - |
|
| 379 | - $stmt->bind( 1, $context->getLocale()->getSiteId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
| 380 | - $stmt->bind( 2, $item->getCode() ); // canonical username |
|
| 381 | - $stmt->bind( 3, $item->getCode() ); // username |
|
| 382 | - $stmt->bind( 4, $billingAddress->getCompany() ); |
|
| 383 | - $stmt->bind( 5, $billingAddress->getVatID() ); |
|
| 384 | - $stmt->bind( 6, $billingAddress->getSalutation() ); |
|
| 385 | - $stmt->bind( 7, $billingAddress->getTitle() ); |
|
| 386 | - $stmt->bind( 8, $billingAddress->getFirstname() ); |
|
| 387 | - $stmt->bind( 9, $billingAddress->getLastname() ); |
|
| 388 | - $stmt->bind( 10, $billingAddress->getAddress1() ); |
|
| 389 | - $stmt->bind( 11, $billingAddress->getAddress2() ); |
|
| 390 | - $stmt->bind( 12, $billingAddress->getAddress3() ); |
|
| 391 | - $stmt->bind( 13, $billingAddress->getPostal() ); |
|
| 392 | - $stmt->bind( 14, $billingAddress->getCity() ); |
|
| 393 | - $stmt->bind( 15, $billingAddress->getState() ); |
|
| 394 | - $stmt->bind( 16, $billingAddress->getCountryId() ); |
|
| 395 | - $stmt->bind( 17, $billingAddress->getLanguageId() ); |
|
| 396 | - $stmt->bind( 18, $billingAddress->getTelephone() ); |
|
| 397 | - $stmt->bind( 19, $billingAddress->getEmail() ); |
|
| 398 | - $stmt->bind( 20, $billingAddress->getEmail() ); |
|
| 399 | - $stmt->bind( 21, $billingAddress->getTelefax() ); |
|
| 400 | - $stmt->bind( 22, $billingAddress->getWebsite() ); |
|
| 401 | - $stmt->bind( 23, $billingAddress->getLongitude() ); |
|
| 402 | - $stmt->bind( 24, $billingAddress->getLatitude() ); |
|
| 403 | - $stmt->bind( 25, $item->getBirthday() ); |
|
| 404 | - $stmt->bind( 26, ( $item->getStatus() > 0 ? true : false ), \Aimeos\MW\DB\Statement\Base::PARAM_BOOL ); |
|
| 405 | - $stmt->bind( 27, $item->getDateVerified() ); |
|
| 406 | - $stmt->bind( 28, $item->getPassword() ); |
|
| 407 | - $stmt->bind( 29, $date ); // Modification time |
|
| 408 | - $stmt->bind( 30, $context->getEditor() ); |
|
| 409 | - $stmt->bind( 31, serialize( $item->getRoles() ) ); |
|
| 410 | - $stmt->bind( 32, $item->getSalt() ); |
|
| 411 | - |
|
| 412 | - if( $id !== null ) { |
|
| 413 | - $stmt->bind( 33, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
| 414 | - $item->setId( $id ); |
|
| 377 | + $stmt = $this->getCachedStatement($conn, $path); |
|
| 378 | + |
|
| 379 | + $stmt->bind(1, $context->getLocale()->getSiteId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
| 380 | + $stmt->bind(2, $item->getCode()); // canonical username |
|
| 381 | + $stmt->bind(3, $item->getCode()); // username |
|
| 382 | + $stmt->bind(4, $billingAddress->getCompany()); |
|
| 383 | + $stmt->bind(5, $billingAddress->getVatID()); |
|
| 384 | + $stmt->bind(6, $billingAddress->getSalutation()); |
|
| 385 | + $stmt->bind(7, $billingAddress->getTitle()); |
|
| 386 | + $stmt->bind(8, $billingAddress->getFirstname()); |
|
| 387 | + $stmt->bind(9, $billingAddress->getLastname()); |
|
| 388 | + $stmt->bind(10, $billingAddress->getAddress1()); |
|
| 389 | + $stmt->bind(11, $billingAddress->getAddress2()); |
|
| 390 | + $stmt->bind(12, $billingAddress->getAddress3()); |
|
| 391 | + $stmt->bind(13, $billingAddress->getPostal()); |
|
| 392 | + $stmt->bind(14, $billingAddress->getCity()); |
|
| 393 | + $stmt->bind(15, $billingAddress->getState()); |
|
| 394 | + $stmt->bind(16, $billingAddress->getCountryId()); |
|
| 395 | + $stmt->bind(17, $billingAddress->getLanguageId()); |
|
| 396 | + $stmt->bind(18, $billingAddress->getTelephone()); |
|
| 397 | + $stmt->bind(19, $billingAddress->getEmail()); |
|
| 398 | + $stmt->bind(20, $billingAddress->getEmail()); |
|
| 399 | + $stmt->bind(21, $billingAddress->getTelefax()); |
|
| 400 | + $stmt->bind(22, $billingAddress->getWebsite()); |
|
| 401 | + $stmt->bind(23, $billingAddress->getLongitude()); |
|
| 402 | + $stmt->bind(24, $billingAddress->getLatitude()); |
|
| 403 | + $stmt->bind(25, $item->getBirthday()); |
|
| 404 | + $stmt->bind(26, ($item->getStatus() > 0 ? true : false), \Aimeos\MW\DB\Statement\Base::PARAM_BOOL); |
|
| 405 | + $stmt->bind(27, $item->getDateVerified()); |
|
| 406 | + $stmt->bind(28, $item->getPassword()); |
|
| 407 | + $stmt->bind(29, $date); // Modification time |
|
| 408 | + $stmt->bind(30, $context->getEditor()); |
|
| 409 | + $stmt->bind(31, serialize($item->getRoles())); |
|
| 410 | + $stmt->bind(32, $item->getSalt()); |
|
| 411 | + |
|
| 412 | + if ($id !== null) { |
|
| 413 | + $stmt->bind(33, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
| 414 | + $item->setId($id); |
|
| 415 | 415 | } else { |
| 416 | - $stmt->bind( 33, $date ); // Creation time |
|
| 416 | + $stmt->bind(33, $date); // Creation time |
|
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | $stmt->execute()->finish(); |
| 420 | 420 | |
| 421 | - if( $id === null && $fetch === true ) |
|
| 421 | + if ($id === null && $fetch === true) |
|
| 422 | 422 | { |
| 423 | 423 | /** mshop/customer/manager/fosuser/newid |
| 424 | 424 | * Retrieves the ID generated by the database when inserting a new record |
@@ -451,22 +451,22 @@ discard block |
||
| 451 | 451 | * @see mshop/customer/manager/fosuser/count |
| 452 | 452 | */ |
| 453 | 453 | $path = 'mshop/customer/manager/fosuser/newid'; |
| 454 | - $item->setId( $this->newId( $conn, $path ) ); |
|
| 454 | + $item->setId($this->newId($conn, $path)); |
|
| 455 | 455 | } |
| 456 | 456 | |
| 457 | - $dbm->release( $conn, $dbname ); |
|
| 457 | + $dbm->release($conn, $dbname); |
|
| 458 | 458 | } |
| 459 | - catch( \Exception $e ) |
|
| 459 | + catch (\Exception $e) |
|
| 460 | 460 | { |
| 461 | - $dbm->release( $conn, $dbname ); |
|
| 461 | + $dbm->release($conn, $dbname); |
|
| 462 | 462 | throw $e; |
| 463 | 463 | } |
| 464 | 464 | |
| 465 | - $this->addGroups( $item ); |
|
| 465 | + $this->addGroups($item); |
|
| 466 | 466 | |
| 467 | - $item = $this->savePropertyItems( $item, 'customer' ); |
|
| 468 | - $item = $this->saveAddressItems( $item, 'customer' ); |
|
| 469 | - return $this->saveListItems( $item, 'customer' ); |
|
| 467 | + $item = $this->savePropertyItems($item, 'customer'); |
|
| 468 | + $item = $this->saveAddressItems($item, 'customer'); |
|
| 469 | + return $this->saveListItems($item, 'customer'); |
|
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | |
@@ -478,11 +478,11 @@ discard block |
||
| 478 | 478 | * @return array List of items implementing \Aimeos\MShop\Customer\Item\Iface |
| 479 | 479 | * @throws \Aimeos\MShop\Customer\Exception If creating items failed |
| 480 | 480 | */ |
| 481 | - public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null ) |
|
| 481 | + public function searchItems(\Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null) |
|
| 482 | 482 | { |
| 483 | 483 | $dbm = $this->getContext()->getDatabaseManager(); |
| 484 | 484 | $dbname = $this->getResourceName(); |
| 485 | - $conn = $dbm->acquire( $dbname ); |
|
| 485 | + $conn = $dbm->acquire($dbname); |
|
| 486 | 486 | $map = []; |
| 487 | 487 | |
| 488 | 488 | try |
@@ -490,32 +490,32 @@ discard block |
||
| 490 | 490 | $level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL; |
| 491 | 491 | $cfgPathSearch = 'mshop/customer/manager/fosuser/search'; |
| 492 | 492 | $cfgPathCount = 'mshop/customer/manager/fosuser/count'; |
| 493 | - $required = array( 'customer' ); |
|
| 493 | + $required = array('customer'); |
|
| 494 | 494 | |
| 495 | - $results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level ); |
|
| 496 | - while( ( $row = $results->fetch() ) !== false ) { |
|
| 497 | - $map[ $row['customer.id'] ] = $row; |
|
| 495 | + $results = $this->searchItemsBase($conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level); |
|
| 496 | + while (($row = $results->fetch()) !== false) { |
|
| 497 | + $map[$row['customer.id']] = $row; |
|
| 498 | 498 | } |
| 499 | 499 | |
| 500 | - $dbm->release( $conn, $dbname ); |
|
| 500 | + $dbm->release($conn, $dbname); |
|
| 501 | 501 | } |
| 502 | - catch( \Exception $e ) |
|
| 502 | + catch (\Exception $e) |
|
| 503 | 503 | { |
| 504 | - $dbm->release( $conn, $dbname ); |
|
| 504 | + $dbm->release($conn, $dbname); |
|
| 505 | 505 | throw $e; |
| 506 | 506 | } |
| 507 | 507 | |
| 508 | 508 | $addrItems = []; |
| 509 | - if( in_array( 'customer/address', $ref, true ) ) { |
|
| 510 | - $addrItems = $this->getAddressItems( array_keys( $map ), 'customer' ); |
|
| 509 | + if (in_array('customer/address', $ref, true)) { |
|
| 510 | + $addrItems = $this->getAddressItems(array_keys($map), 'customer'); |
|
| 511 | 511 | } |
| 512 | 512 | |
| 513 | 513 | $propItems = []; |
| 514 | - if( in_array( 'customer/property', $ref, true ) ) { |
|
| 515 | - $propItems = $this->getPropertyItems( array_keys( $map ), 'customer' ); |
|
| 514 | + if (in_array('customer/property', $ref, true)) { |
|
| 515 | + $propItems = $this->getPropertyItems(array_keys($map), 'customer'); |
|
| 516 | 516 | } |
| 517 | 517 | |
| 518 | - return $this->buildItems( $map, $ref, 'customer', $addrItems, $propItems ); |
|
| 518 | + return $this->buildItems($map, $ref, 'customer', $addrItems, $propItems); |
|
| 519 | 519 | } |
| 520 | 520 | |
| 521 | 521 | |
@@ -526,9 +526,9 @@ discard block |
||
| 526 | 526 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
| 527 | 527 | * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
| 528 | 528 | */ |
| 529 | - public function getSubManager( $manager, $name = null ) |
|
| 529 | + public function getSubManager($manager, $name = null) |
|
| 530 | 530 | { |
| 531 | - return $this->getSubManagerBase( 'customer', $manager, ( $name === null ? 'FosUser' : $name ) ); |
|
| 531 | + return $this->getSubManagerBase('customer', $manager, ($name === null ? 'FosUser' : $name)); |
|
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | |
@@ -542,15 +542,15 @@ discard block |
||
| 542 | 542 | * @param array $propItems List of property items of the customer item |
| 543 | 543 | * @return \Aimeos\MShop\Customer\Item\Iface New customer item |
| 544 | 544 | */ |
| 545 | - protected function createItemBase( array $values = [], array $listItems = [], array $refItems = [], |
|
| 546 | - array $addresses = [], array $propItems = [] ) |
|
| 545 | + protected function createItemBase(array $values = [], array $listItems = [], array $refItems = [], |
|
| 546 | + array $addresses = [], array $propItems = []) |
|
| 547 | 547 | { |
| 548 | - if( !isset( $this->addressManager ) ) { |
|
| 549 | - $this->addressManager = $this->getObject()->getSubManager( 'address' ); |
|
| 548 | + if (!isset($this->addressManager)) { |
|
| 549 | + $this->addressManager = $this->getObject()->getSubManager('address'); |
|
| 550 | 550 | } |
| 551 | 551 | |
| 552 | - if( isset( $values['roles'] ) ) { |
|
| 553 | - $values['roles'] = unserialize( $values['roles'] ); |
|
| 552 | + if (isset($values['roles'])) { |
|
| 553 | + $values['roles'] = unserialize($values['roles']); |
|
| 554 | 554 | } |
| 555 | 555 | |
| 556 | 556 | $helper = $this->getPasswordHelper(); |