@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | * @param \Aimeos\MW\Config\Iface $config Configuration object |
32 | 32 | * @param string $tempdir Directory for storing temporary files |
33 | 33 | */ |
34 | - public function __construct( \Illuminate\Filesystem\FilesystemManager $fsm, \Aimeos\MW\Config\Iface $config, $tempdir ) |
|
34 | + public function __construct(\Illuminate\Filesystem\FilesystemManager $fsm, \Aimeos\MW\Config\Iface $config, $tempdir) |
|
35 | 35 | { |
36 | - parent::__construct( $config ); |
|
36 | + parent::__construct($config); |
|
37 | 37 | |
38 | 38 | $this->fsm = $fsm; |
39 | 39 | $this->tempdir = $tempdir; |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function __destruct() |
47 | 47 | { |
48 | - foreach( $this->objects as $key => $object ) { |
|
49 | - unset( $this->objects[$key] ); |
|
48 | + foreach ($this->objects as $key => $object) { |
|
49 | + unset($this->objects[$key]); |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | $this->objects = []; |
62 | 62 | |
63 | - return get_object_vars( $this ); |
|
63 | + return get_object_vars($this); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | |
@@ -71,19 +71,19 @@ discard block |
||
71 | 71 | * @return \Aimeos\MW\Filesystem\Iface File system object |
72 | 72 | * @throws \Aimeos\MW\Filesystem\Exception If an no configuration for that name is found |
73 | 73 | */ |
74 | - public function get( $name ) |
|
74 | + public function get($name) |
|
75 | 75 | { |
76 | - $key = $this->getConfig( $name ); |
|
76 | + $key = $this->getConfig($name); |
|
77 | 77 | |
78 | - if( is_string( $key ) ) |
|
78 | + if (is_string($key)) |
|
79 | 79 | { |
80 | - if( !isset( $this->objects[$key] ) ) { |
|
81 | - $this->objects[$key] = new \Aimeos\MW\Filesystem\Laravel( $this->fsm->disk( $key ), $this->tempdir ); |
|
80 | + if (!isset($this->objects[$key])) { |
|
81 | + $this->objects[$key] = new \Aimeos\MW\Filesystem\Laravel($this->fsm->disk($key), $this->tempdir); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | return $this->objects[$key]; |
85 | 85 | } |
86 | 86 | |
87 | - return parent::get( $name ); |
|
87 | + return parent::get($name); |
|
88 | 88 | } |
89 | 89 | } |
@@ -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, 'Laravel' ); |
|
24 | - $this->object = $manager->getSubManager( 'property', 'Laravel' )->getSubManager( 'type', 'Laravel' ); |
|
23 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context, 'Laravel'); |
|
24 | + $this->object = $manager->getSubManager('property', 'Laravel')->getSubManager('type', 'Laravel'); |
|
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.position', 0 ); |
|
157 | - $expr[] = $search->compare( '==', 'customer.property.type.status', 1 ); |
|
158 | - $expr[] = $search->compare( '>=', 'customer.property.type.mtime', '1970-01-01 00:00:00' ); |
|
159 | - $expr[] = $search->compare( '>=', 'customer.property.type.ctime', '1970-01-01 00:00:00' ); |
|
160 | - $expr[] = $search->compare( '==', 'customer.property.type.editor', $this->editor ); |
|
161 | - |
|
162 | - $search->setConditions( $search->combine('&&', $expr) ); |
|
163 | - $results = $this->object->searchItems( $search, [], $total ); |
|
164 | - $this->assertEquals( 1, count( $results ) ); |
|
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.position', 0); |
|
157 | + $expr[] = $search->compare('==', 'customer.property.type.status', 1); |
|
158 | + $expr[] = $search->compare('>=', 'customer.property.type.mtime', '1970-01-01 00:00:00'); |
|
159 | + $expr[] = $search->compare('>=', 'customer.property.type.ctime', '1970-01-01 00:00:00'); |
|
160 | + $expr[] = $search->compare('==', 'customer.property.type.editor', $this->editor); |
|
161 | + |
|
162 | + $search->setConditions($search->combine('&&', $expr)); |
|
163 | + $results = $this->object->searchItems($search, [], $total); |
|
164 | + $this->assertEquals(1, count($results)); |
|
165 | 165 | |
166 | 166 | |
167 | 167 | $search = $this->object->createSearch(); |
168 | 168 | $conditions = array( |
169 | - $search->compare( '=~', 'customer.property.type.code', 'newsletter'), |
|
170 | - $search->compare( '==', 'customer.property.type.editor', $this->editor ) |
|
169 | + $search->compare('=~', 'customer.property.type.code', 'newsletter'), |
|
170 | + $search->compare('==', 'customer.property.type.editor', $this->editor) |
|
171 | 171 | ); |
172 | - $search->setConditions( $search->combine('&&', $conditions ) ); |
|
172 | + $search->setConditions($search->combine('&&', $conditions)); |
|
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 |
@@ -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, 'Laravel' ); |
|
24 | - $this->object = $manager->getSubManager( 'property', 'Laravel' ); |
|
23 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context, 'Laravel'); |
|
24 | + $this->object = $manager->getSubManager('property', 'Laravel'); |
|
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'); |
@@ -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,29 +286,29 @@ 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 | - self::checkClass( '\\Aimeos\\MShop\\Customer\\Item\\Iface', $item ); |
|
291 | + self::checkClass('\\Aimeos\\MShop\\Customer\\Item\\Iface', $item); |
|
292 | 292 | |
293 | - if( !$item->isModified() ) |
|
293 | + if (!$item->isModified()) |
|
294 | 294 | { |
295 | - $item = $this->savePropertyItems( $item, 'customer' ); |
|
296 | - $item = $this->saveAddressItems( $item, 'customer' ); |
|
297 | - return $this->saveListItems( $item, 'customer' ); |
|
295 | + $item = $this->savePropertyItems($item, 'customer'); |
|
296 | + $item = $this->saveAddressItems($item, 'customer'); |
|
297 | + return $this->saveListItems($item, 'customer'); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | $context = $this->getContext(); |
301 | 301 | $dbm = $context->getDatabaseManager(); |
302 | 302 | $dbname = $this->getResourceName(); |
303 | - $conn = $dbm->acquire( $dbname ); |
|
303 | + $conn = $dbm->acquire($dbname); |
|
304 | 304 | |
305 | 305 | try |
306 | 306 | { |
307 | 307 | $id = $item->getId(); |
308 | - $date = date( 'Y-m-d H:i:s' ); |
|
308 | + $date = date('Y-m-d H:i:s'); |
|
309 | 309 | $billingAddress = $item->getPaymentAddress(); |
310 | 310 | |
311 | - if( $id === null ) |
|
311 | + if ($id === null) |
|
312 | 312 | { |
313 | 313 | /** mshop/customer/manager/laravel/insert |
314 | 314 | * Inserts a new customer record into the database table |
@@ -372,48 +372,48 @@ discard block |
||
372 | 372 | $path = 'mshop/customer/manager/laravel/update'; |
373 | 373 | } |
374 | 374 | |
375 | - $stmt = $this->getCachedStatement( $conn, $path ); |
|
376 | - |
|
377 | - $stmt->bind( 1, $context->getLocale()->getSiteId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
378 | - $stmt->bind( 2, $item->getCode() ); |
|
379 | - $stmt->bind( 3, $billingAddress->getCompany() ); |
|
380 | - $stmt->bind( 4, $billingAddress->getVatID() ); |
|
381 | - $stmt->bind( 5, $billingAddress->getSalutation() ); |
|
382 | - $stmt->bind( 6, $billingAddress->getTitle() ); |
|
383 | - $stmt->bind( 7, $billingAddress->getFirstname() ); |
|
384 | - $stmt->bind( 8, $billingAddress->getLastname() ); |
|
385 | - $stmt->bind( 9, $billingAddress->getAddress1() ); |
|
386 | - $stmt->bind( 10, $billingAddress->getAddress2() ); |
|
387 | - $stmt->bind( 11, $billingAddress->getAddress3() ); |
|
388 | - $stmt->bind( 12, $billingAddress->getPostal() ); |
|
389 | - $stmt->bind( 13, $billingAddress->getCity() ); |
|
390 | - $stmt->bind( 14, $billingAddress->getState() ); |
|
391 | - $stmt->bind( 15, $billingAddress->getCountryId() ); |
|
392 | - $stmt->bind( 16, $billingAddress->getLanguageId() ); |
|
393 | - $stmt->bind( 17, $billingAddress->getTelephone() ); |
|
394 | - $stmt->bind( 18, $billingAddress->getTelefax() ); |
|
395 | - $stmt->bind( 19, $billingAddress->getWebsite() ); |
|
396 | - $stmt->bind( 20, $billingAddress->getEmail() ); |
|
397 | - $stmt->bind( 21, $billingAddress->getLongitude() ); |
|
398 | - $stmt->bind( 22, $billingAddress->getLatitude() ); |
|
399 | - $stmt->bind( 23, $item->getLabel() ); |
|
400 | - $stmt->bind( 24, $item->getBirthday() ); |
|
401 | - $stmt->bind( 25, $item->getStatus(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
402 | - $stmt->bind( 26, $item->getDateVerified() ); |
|
403 | - $stmt->bind( 27, $item->getPassword() ); |
|
404 | - $stmt->bind( 28, $date ); // Modification time |
|
405 | - $stmt->bind( 29, $context->getEditor() ); |
|
406 | - |
|
407 | - if( $id !== null ) { |
|
408 | - $stmt->bind( 30, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
409 | - $item->setId( $id ); |
|
375 | + $stmt = $this->getCachedStatement($conn, $path); |
|
376 | + |
|
377 | + $stmt->bind(1, $context->getLocale()->getSiteId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
378 | + $stmt->bind(2, $item->getCode()); |
|
379 | + $stmt->bind(3, $billingAddress->getCompany()); |
|
380 | + $stmt->bind(4, $billingAddress->getVatID()); |
|
381 | + $stmt->bind(5, $billingAddress->getSalutation()); |
|
382 | + $stmt->bind(6, $billingAddress->getTitle()); |
|
383 | + $stmt->bind(7, $billingAddress->getFirstname()); |
|
384 | + $stmt->bind(8, $billingAddress->getLastname()); |
|
385 | + $stmt->bind(9, $billingAddress->getAddress1()); |
|
386 | + $stmt->bind(10, $billingAddress->getAddress2()); |
|
387 | + $stmt->bind(11, $billingAddress->getAddress3()); |
|
388 | + $stmt->bind(12, $billingAddress->getPostal()); |
|
389 | + $stmt->bind(13, $billingAddress->getCity()); |
|
390 | + $stmt->bind(14, $billingAddress->getState()); |
|
391 | + $stmt->bind(15, $billingAddress->getCountryId()); |
|
392 | + $stmt->bind(16, $billingAddress->getLanguageId()); |
|
393 | + $stmt->bind(17, $billingAddress->getTelephone()); |
|
394 | + $stmt->bind(18, $billingAddress->getTelefax()); |
|
395 | + $stmt->bind(19, $billingAddress->getWebsite()); |
|
396 | + $stmt->bind(20, $billingAddress->getEmail()); |
|
397 | + $stmt->bind(21, $billingAddress->getLongitude()); |
|
398 | + $stmt->bind(22, $billingAddress->getLatitude()); |
|
399 | + $stmt->bind(23, $item->getLabel()); |
|
400 | + $stmt->bind(24, $item->getBirthday()); |
|
401 | + $stmt->bind(25, $item->getStatus(), \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
402 | + $stmt->bind(26, $item->getDateVerified()); |
|
403 | + $stmt->bind(27, $item->getPassword()); |
|
404 | + $stmt->bind(28, $date); // Modification time |
|
405 | + $stmt->bind(29, $context->getEditor()); |
|
406 | + |
|
407 | + if ($id !== null) { |
|
408 | + $stmt->bind(30, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
409 | + $item->setId($id); |
|
410 | 410 | } else { |
411 | - $stmt->bind( 30, $date ); // Creation time |
|
411 | + $stmt->bind(30, $date); // Creation time |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | $stmt->execute()->finish(); |
415 | 415 | |
416 | - if( $id === null && $fetch === true ) |
|
416 | + if ($id === null && $fetch === true) |
|
417 | 417 | { |
418 | 418 | /** mshop/customer/manager/laravel/newid |
419 | 419 | * Retrieves the ID generated by the database when inserting a new record |
@@ -446,22 +446,22 @@ discard block |
||
446 | 446 | * @see mshop/customer/manager/laravel/count |
447 | 447 | */ |
448 | 448 | $path = 'mshop/customer/manager/laravel/newid'; |
449 | - $item->setId( $this->newId( $conn, $path ) ); |
|
449 | + $item->setId($this->newId($conn, $path)); |
|
450 | 450 | } |
451 | 451 | |
452 | - $dbm->release( $conn, $dbname ); |
|
452 | + $dbm->release($conn, $dbname); |
|
453 | 453 | } |
454 | - catch( \Exception $e ) |
|
454 | + catch (\Exception $e) |
|
455 | 455 | { |
456 | - $dbm->release( $conn, $dbname ); |
|
456 | + $dbm->release($conn, $dbname); |
|
457 | 457 | throw $e; |
458 | 458 | } |
459 | 459 | |
460 | - $this->addGroups( $item ); |
|
460 | + $this->addGroups($item); |
|
461 | 461 | |
462 | - $item = $this->savePropertyItems( $item, 'customer' ); |
|
463 | - $item = $this->saveAddressItems( $item, 'customer' ); |
|
464 | - return $this->saveListItems( $item, 'customer' ); |
|
462 | + $item = $this->savePropertyItems($item, 'customer'); |
|
463 | + $item = $this->saveAddressItems($item, 'customer'); |
|
464 | + return $this->saveListItems($item, 'customer'); |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | |
@@ -473,11 +473,11 @@ discard block |
||
473 | 473 | * @return array List of items implementing \Aimeos\MShop\Customer\Item\Iface |
474 | 474 | * @throws \Aimeos\MShop\Customer\Exception If creating items failed |
475 | 475 | */ |
476 | - public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null ) |
|
476 | + public function searchItems(\Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null) |
|
477 | 477 | { |
478 | 478 | $dbm = $this->getContext()->getDatabaseManager(); |
479 | 479 | $dbname = $this->getResourceName(); |
480 | - $conn = $dbm->acquire( $dbname ); |
|
480 | + $conn = $dbm->acquire($dbname); |
|
481 | 481 | $map = []; |
482 | 482 | |
483 | 483 | try |
@@ -485,32 +485,32 @@ discard block |
||
485 | 485 | $level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL; |
486 | 486 | $cfgPathSearch = 'mshop/customer/manager/laravel/search'; |
487 | 487 | $cfgPathCount = 'mshop/customer/manager/laravel/count'; |
488 | - $required = array( 'customer' ); |
|
488 | + $required = array('customer'); |
|
489 | 489 | |
490 | - $results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level ); |
|
491 | - while( ( $row = $results->fetch() ) !== false ) { |
|
492 | - $map[ $row['customer.id'] ] = $row; |
|
490 | + $results = $this->searchItemsBase($conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level); |
|
491 | + while (($row = $results->fetch()) !== false) { |
|
492 | + $map[$row['customer.id']] = $row; |
|
493 | 493 | } |
494 | 494 | |
495 | - $dbm->release( $conn, $dbname ); |
|
495 | + $dbm->release($conn, $dbname); |
|
496 | 496 | } |
497 | - catch( \Exception $e ) |
|
497 | + catch (\Exception $e) |
|
498 | 498 | { |
499 | - $dbm->release( $conn, $dbname ); |
|
499 | + $dbm->release($conn, $dbname); |
|
500 | 500 | throw $e; |
501 | 501 | } |
502 | 502 | |
503 | 503 | $addrItems = []; |
504 | - if( in_array( 'customer/address', $ref, true ) ) { |
|
505 | - $addrItems = $this->getAddressItems( array_keys( $map ), 'customer' ); |
|
504 | + if (in_array('customer/address', $ref, true)) { |
|
505 | + $addrItems = $this->getAddressItems(array_keys($map), 'customer'); |
|
506 | 506 | } |
507 | 507 | |
508 | 508 | $propItems = []; |
509 | - if( in_array( 'customer/property', $ref, true ) ) { |
|
510 | - $propItems = $this->getPropertyItems( array_keys( $map ), 'customer' ); |
|
509 | + if (in_array('customer/property', $ref, true)) { |
|
510 | + $propItems = $this->getPropertyItems(array_keys($map), 'customer'); |
|
511 | 511 | } |
512 | 512 | |
513 | - return $this->buildItems( $map, $ref, 'customer', $addrItems, $propItems ); |
|
513 | + return $this->buildItems($map, $ref, 'customer', $addrItems, $propItems); |
|
514 | 514 | } |
515 | 515 | |
516 | 516 | |
@@ -521,8 +521,8 @@ discard block |
||
521 | 521 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
522 | 522 | * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
523 | 523 | */ |
524 | - public function getSubManager( $manager, $name = null ) |
|
524 | + public function getSubManager($manager, $name = null) |
|
525 | 525 | { |
526 | - return $this->getSubManagerBase( 'customer', $manager, ( $name === null ? 'Laravel' : $name ) ); |
|
526 | + return $this->getSubManagerBase('customer', $manager, ($name === null ? 'Laravel' : $name)); |
|
527 | 527 | } |
528 | 528 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function getPreDependencies() |
23 | 23 | { |
24 | - return array( 'TablesAddLaravelTestData' ); |
|
24 | + return array('TablesAddLaravelTestData'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | |
@@ -30,34 +30,34 @@ 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 Laravel customer test data', 0 ); |
|
36 | - $this->additional->setEditor( 'ai-laravel:unittest' ); |
|
35 | + $this->msg('Adding Laravel customer test data', 0); |
|
36 | + $this->additional->setEditor('ai-laravel:unittest'); |
|
37 | 37 | |
38 | 38 | $parentIds = []; |
39 | 39 | $ds = DIRECTORY_SEPARATOR; |
40 | - $path = __DIR__ . $ds . 'data' . $ds . 'customer.php'; |
|
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, 'Laravel' ); |
|
48 | - $customerAddressManager = $customerManager->getSubManager( 'address', 'Laravel' ); |
|
47 | + $customerManager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->additional, 'Laravel'); |
|
48 | + $customerAddressManager = $customerManager->getSubManager('address', 'Laravel'); |
|
49 | 49 | |
50 | - $this->cleanupCustomerData( $customerManager, $customerAddressManager ); |
|
50 | + $this->cleanupCustomerData($customerManager, $customerAddressManager); |
|
51 | 51 | |
52 | 52 | $this->conn->begin(); |
53 | 53 | |
54 | - $parentIds = $this->addCustomerData( $testdata, $customerManager, $customerAddressManager->createItem() ); |
|
55 | - $this->addCustomerAddressData( $testdata, $customerAddressManager, $parentIds ); |
|
54 | + $parentIds = $this->addCustomerData($testdata, $customerManager, $customerAddressManager->createItem()); |
|
55 | + $this->addCustomerAddressData($testdata, $customerAddressManager, $parentIds); |
|
56 | 56 | |
57 | 57 | $this->conn->commit(); |
58 | 58 | |
59 | 59 | |
60 | - $this->status( 'done' ); |
|
60 | + $this->status('done'); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
@@ -67,17 +67,17 @@ discard block |
||
67 | 67 | * @param \Aimeos\MShop\Common\Manager\Iface $customerManager Customer manager |
68 | 68 | * @param \Aimeos\MShop\Common\Manager\Iface $customerAddressManager Customer address manager |
69 | 69 | */ |
70 | - protected function cleanupCustomerData( \Aimeos\MShop\Common\Manager\Iface $customerManager, \Aimeos\MShop\Common\Manager\Iface $customerAddressManager ) |
|
70 | + protected function cleanupCustomerData(\Aimeos\MShop\Common\Manager\Iface $customerManager, \Aimeos\MShop\Common\Manager\Iface $customerAddressManager) |
|
71 | 71 | { |
72 | 72 | $search = $customerManager->createSearch(); |
73 | - $search->setConditions( $search->compare( '=~', 'customer.code', 'UTC00' ) ); |
|
74 | - $customerItems = $customerManager->searchItems( $search ); |
|
73 | + $search->setConditions($search->compare('=~', 'customer.code', 'UTC00')); |
|
74 | + $customerItems = $customerManager->searchItems($search); |
|
75 | 75 | |
76 | 76 | $search = $customerAddressManager->createSearch(); |
77 | - $search->setConditions( $search->compare( '=~', 'customer.address.email', 'unitCustomer' ) ); |
|
78 | - $addressItems = $customerAddressManager->searchItems( $search ); |
|
77 | + $search->setConditions($search->compare('=~', 'customer.address.email', 'unitCustomer')); |
|
78 | + $addressItems = $customerAddressManager->searchItems($search); |
|
79 | 79 | |
80 | - $customerAddressManager->deleteItems( array_keys( $addressItems ) ); |
|
81 | - $customerManager->deleteItems( array_keys( $customerItems ) ); |
|
80 | + $customerAddressManager->deleteItems(array_keys($addressItems)); |
|
81 | + $customerManager->deleteItems(array_keys($customerItems)); |
|
82 | 82 | } |
83 | 83 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function getPreDependencies() |
24 | 24 | { |
25 | - return array( 'TablesCreateLaravel', 'CustomerAddLaravelTestData', 'LocaleAddTestData', 'TextAddTestData' ); |
|
25 | + return array('TablesCreateLaravel', 'CustomerAddLaravelTestData', '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 Laravel test data', 0 ); |
|
37 | - $this->additional->setEditor( 'ai-laravel:unittest' ); |
|
36 | + $this->msg('Adding customer-list Laravel test data', 0); |
|
37 | + $this->additional->setEditor('ai-laravel:unittest'); |
|
38 | 38 | |
39 | 39 | $ds = DIRECTORY_SEPARATOR; |
40 | - $path = __DIR__ . $ds . 'data' . $ds . 'customer-list.php'; |
|
40 | + $path = __DIR__.$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, 'Laravel' ); |
|
52 | + $refIds['text'] = $this->getTextData($refKeys['text']); |
|
53 | + $this->addCustomerListData($testdata, $refIds, 'Laravel'); |
|
54 | 54 | |
55 | - $this->status( 'done' ); |
|
55 | + $this->status('done'); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | \ No newline at end of file |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function getPreDependencies() |
25 | 25 | { |
26 | - return array( 'TablesCreateLaravel', 'CustomerAddLaravelTestData', 'LocaleAddTestData' ); |
|
26 | + return array('TablesCreateLaravel', 'CustomerAddLaravelTestData', '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 Laravel test data', 0 ); |
|
38 | - $this->additional->setEditor( 'ai-laravel:unittest' ); |
|
37 | + $this->msg('Adding customer-property Laravel test data', 0); |
|
38 | + $this->additional->setEditor('ai-laravel:unittest'); |
|
39 | 39 | |
40 | 40 | $ds = DIRECTORY_SEPARATOR; |
41 | - $path = __DIR__ . $ds . 'data' . $ds . 'customer-property.php'; |
|
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, 'Laravel' ); |
|
47 | + $this->addCustomerPropertyData($testdata, 'Laravel'); |
|
48 | 48 | |
49 | - $this->status( 'done' ); |
|
49 | + $this->status('done'); |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | \ No newline at end of file |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | 'customer.property.id' => array( |
25 | 25 | 'code' => 'customer.property.id', |
26 | 26 | 'internalcode' => 'lvupr."id"', |
27 | - 'internaldeps'=>array( 'LEFT JOIN "users_property" AS lvupr ON ( lvupr."parentid" = lvu."id" )' ), |
|
27 | + 'internaldeps'=>array('LEFT JOIN "users_property" AS lvupr ON ( lvupr."parentid" = lvu."id" )'), |
|
28 | 28 | 'label' => 'Property ID', |
29 | 29 | 'type' => 'integer', |
30 | 30 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @param integer[] $siteids List of IDs for sites whose entries should be deleted |
102 | 102 | */ |
103 | - public function cleanup( array $siteids ) |
|
103 | + public function cleanup(array $siteids) |
|
104 | 104 | { |
105 | 105 | $path = 'mshop/customer/manager/property/submanagers'; |
106 | - foreach( $this->getContext()->getConfig()->get( $path, [] ) as $domain ) { |
|
107 | - $this->getObject()->getSubManager( $domain )->cleanup( $siteids ); |
|
106 | + foreach ($this->getContext()->getConfig()->get($path, []) as $domain) { |
|
107 | + $this->getObject()->getSubManager($domain)->cleanup($siteids); |
|
108 | 108 | } |
109 | 109 | |
110 | - $this->cleanupBase( $siteids, 'mshop/customer/manager/property/laravel/delete' ); |
|
110 | + $this->cleanupBase($siteids, 'mshop/customer/manager/property/laravel/delete'); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | |
@@ -117,11 +117,11 @@ discard block |
||
117 | 117 | * @param boolean $withsub Return also attributes of sub-managers if true |
118 | 118 | * @return array Returns a list of attribtes implementing \Aimeos\MW\Criteria\Attribute\Iface |
119 | 119 | */ |
120 | - public function getSearchAttributes( $withsub = true ) |
|
120 | + public function getSearchAttributes($withsub = true) |
|
121 | 121 | { |
122 | 122 | $path = 'mshop/customer/manager/property/submanagers'; |
123 | 123 | |
124 | - return $this->getSearchAttributesBase( $this->searchConfig, $path, ['type'], $withsub ); |
|
124 | + return $this->getSearchAttributesBase($this->searchConfig, $path, ['type'], $withsub); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | * configuration (or Default) if null |
134 | 134 | * @return \Aimeos\MShop\Common\Manager\Iface Manager for different extensions, e.g property types, property lists etc. |
135 | 135 | */ |
136 | - public function getSubManager( $manager, $name = null ) |
|
136 | + public function getSubManager($manager, $name = null) |
|
137 | 137 | { |
138 | - return $this->getSubManagerBase( 'customer', 'property/' . $manager, ( $name === null ? 'Laravel' : $name ) ); |
|
138 | + return $this->getSubManagerBase('customer', 'property/'.$manager, ($name === null ? 'Laravel' : $name)); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 |
@@ -5,19 +5,19 @@ |
||
5 | 5 | * @copyright Aimeos (aimeos.org), 2014-2018 |
6 | 6 | */ |
7 | 7 | |
8 | -return array ( |
|
9 | - 'customer/lists/type' => array ( |
|
10 | - 'customer/group/default' => array( 'domain' => 'customer/group', 'code' => 'default', 'label' => 'Standard', 'status' => 1 ), |
|
11 | - 'order/download' => array( 'domain' => 'order', 'code' => 'download', 'label' => 'Download', 'status' => 1 ), |
|
12 | - 'product/favorite' => array( 'domain' => 'product', 'code' => 'favorite', 'label' => 'Favorite', 'status' => 1 ), |
|
13 | - 'product/watch' => array( 'domain' => 'product', 'code' => 'watch', 'label' => 'Watch list', 'status' => 1 ), |
|
14 | - 'text/default' => array( 'domain' => 'text', 'code' => 'default', 'label' => 'Standard', 'status' => 1 ), |
|
8 | +return array( |
|
9 | + 'customer/lists/type' => array( |
|
10 | + 'customer/group/default' => array('domain' => 'customer/group', 'code' => 'default', 'label' => 'Standard', 'status' => 1), |
|
11 | + 'order/download' => array('domain' => 'order', 'code' => 'download', 'label' => 'Download', 'status' => 1), |
|
12 | + 'product/favorite' => array('domain' => 'product', 'code' => 'favorite', 'label' => 'Favorite', 'status' => 1), |
|
13 | + 'product/watch' => array('domain' => 'product', 'code' => 'watch', 'label' => 'Watch list', 'status' => 1), |
|
14 | + 'text/default' => array('domain' => 'text', 'code' => 'default', 'label' => 'Standard', 'status' => 1), |
|
15 | 15 | ), |
16 | 16 | |
17 | - 'customer/lists' => array ( |
|
18 | - array( 'parentid' => 'customer/UTC003', 'typeid' => 'text/default', 'domain' => 'text', 'refid' => 'text/customer/information', 'start' => '2010-01-01 00:00:00', 'end' => '2100-01-01 00:00:00', 'config' => [], 'pos' => 1, 'status' => 1 ), |
|
19 | - array( 'parentid' => 'customer/UTC003', 'typeid' => 'text/default', 'domain' => 'text', 'refid' => 'text/customer/notify', 'start' => '2010-01-01 00:00:00', 'end' => '2100-01-01 00:00:00', 'config' => [], 'pos' => 2, 'status' => 1 ), |
|
20 | - array( 'parentid' => 'customer/UTC003', 'typeid' => 'text/default', 'domain' => 'text', 'refid' => 'text/customer/newsletter', 'start' => '2010-01-01 00:00:00', 'end' => '2100-01-01 00:00:00', 'config' => [], 'pos' => 3, 'status' => 1 ), |
|
21 | - array( 'parentid' => 'customer/UTC001', 'typeid' => 'text/default', 'domain' => 'text', 'refid' => 'text/customer/information', 'start' => '2010-01-01 00:00:00', 'end' => '2100-01-01 00:00:00', 'config' => [], 'pos' => 1, 'status' => 1 ), |
|
17 | + 'customer/lists' => array( |
|
18 | + array('parentid' => 'customer/UTC003', 'typeid' => 'text/default', 'domain' => 'text', 'refid' => 'text/customer/information', 'start' => '2010-01-01 00:00:00', 'end' => '2100-01-01 00:00:00', 'config' => [], 'pos' => 1, 'status' => 1), |
|
19 | + array('parentid' => 'customer/UTC003', 'typeid' => 'text/default', 'domain' => 'text', 'refid' => 'text/customer/notify', 'start' => '2010-01-01 00:00:00', 'end' => '2100-01-01 00:00:00', 'config' => [], 'pos' => 2, 'status' => 1), |
|
20 | + array('parentid' => 'customer/UTC003', 'typeid' => 'text/default', 'domain' => 'text', 'refid' => 'text/customer/newsletter', 'start' => '2010-01-01 00:00:00', 'end' => '2100-01-01 00:00:00', 'config' => [], 'pos' => 3, 'status' => 1), |
|
21 | + array('parentid' => 'customer/UTC001', 'typeid' => 'text/default', 'domain' => 'text', 'refid' => 'text/customer/information', 'start' => '2010-01-01 00:00:00', 'end' => '2100-01-01 00:00:00', 'config' => [], 'pos' => 1, 'status' => 1), |
|
22 | 22 | ), |
23 | 23 | ); |
24 | 24 | \ No newline at end of file |