@@ -27,14 +27,14 @@ discard block |
||
27 | 27 | * @param array $data Associative list of catalog codes and lists of CSV field indexes and their data |
28 | 28 | * @return array Associative list of CSV field indexes and their converted data |
29 | 29 | */ |
30 | - protected function convertData( array $convlist, array $data ) |
|
30 | + protected function convertData(array $convlist, array $data) |
|
31 | 31 | { |
32 | - foreach( $convlist as $idx => $converter ) |
|
32 | + foreach ($convlist as $idx => $converter) |
|
33 | 33 | { |
34 | - foreach( $data as $code => $list ) |
|
34 | + foreach ($data as $code => $list) |
|
35 | 35 | { |
36 | - if( isset( $list[$idx] ) ) { |
|
37 | - $data[$code][$idx] = $converter->translate( $list[$idx] ); |
|
36 | + if (isset($list[$idx])) { |
|
37 | + $data[$code][$idx] = $converter->translate($list[$idx]); |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | } |
@@ -50,36 +50,36 @@ discard block |
||
50 | 50 | * @param string|null Name of the cache implementation |
51 | 51 | * @return \Aimeos\Controller\Common\Catalog\Import\Csv\Cache\Iface Cache object |
52 | 52 | */ |
53 | - protected function getCache( $type, $name = null ) |
|
53 | + protected function getCache($type, $name = null) |
|
54 | 54 | { |
55 | 55 | $context = $this->getContext(); |
56 | 56 | $config = $context->getConfig(); |
57 | 57 | |
58 | - if( ctype_alnum( $type ) === false ) |
|
58 | + if (ctype_alnum($type) === false) |
|
59 | 59 | { |
60 | 60 | $classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Cache\\' . $type : '<not a string>'; |
61 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
61 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
62 | 62 | } |
63 | 63 | |
64 | - if( $name === null ) { |
|
65 | - $name = $config->get( 'controller/common/catalog/import/csv/cache/' . $type . '/name', 'Standard' ); |
|
64 | + if ($name === null) { |
|
65 | + $name = $config->get('controller/common/catalog/import/csv/cache/' . $type . '/name', 'Standard'); |
|
66 | 66 | } |
67 | 67 | |
68 | - if( ctype_alnum( $name ) === false ) |
|
68 | + if (ctype_alnum($name) === false) |
|
69 | 69 | { |
70 | 70 | $classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Cache\\' . $type . '\\' . $name : '<not a string>'; |
71 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
71 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
72 | 72 | } |
73 | 73 | |
74 | - $classname = '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Cache\\' . ucfirst( $type ) . '\\' . $name; |
|
74 | + $classname = '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Cache\\' . ucfirst($type) . '\\' . $name; |
|
75 | 75 | |
76 | - if( class_exists( $classname ) === false ) { |
|
77 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) ); |
|
76 | + if (class_exists($classname) === false) { |
|
77 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not found', $classname)); |
|
78 | 78 | } |
79 | 79 | |
80 | - $object = new $classname( $context ); |
|
80 | + $object = new $classname($context); |
|
81 | 81 | |
82 | - \Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Cache\\Iface', $object ); |
|
82 | + \Aimeos\MW\Common\Base::checkClass('\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Cache\\Iface', $object); |
|
83 | 83 | |
84 | 84 | return $object; |
85 | 85 | } |
@@ -91,12 +91,12 @@ discard block |
||
91 | 91 | * @param array $convmap List of converter names for the values at the position in the CSV file |
92 | 92 | * @return array Associative list of positions and converter objects |
93 | 93 | */ |
94 | - protected function getConverterList( array $convmap ) |
|
94 | + protected function getConverterList(array $convmap) |
|
95 | 95 | { |
96 | 96 | $convlist = []; |
97 | 97 | |
98 | - foreach( $convmap as $idx => $name ) { |
|
99 | - $convlist[$idx] = \Aimeos\MW\Convert\Factory::createConverter( $name ); |
|
98 | + foreach ($convmap as $idx => $name) { |
|
99 | + $convlist[$idx] = \Aimeos\MW\Convert\Factory::createConverter($name); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | return $convlist; |
@@ -111,15 +111,15 @@ discard block |
||
111 | 111 | * @param integer $codePos Column position which contains the unique catalog code (starting from 0) |
112 | 112 | * @return array List of arrays with catalog codes as keys and list of values from the CSV file |
113 | 113 | */ |
114 | - protected function getData( \Aimeos\MW\Container\Content\Iface $content, $maxcnt, $codePos ) |
|
114 | + protected function getData(\Aimeos\MW\Container\Content\Iface $content, $maxcnt, $codePos) |
|
115 | 115 | { |
116 | 116 | $count = 0; |
117 | 117 | $data = []; |
118 | 118 | |
119 | - while( $content->valid() && $count++ < $maxcnt ) |
|
119 | + while ($content->valid() && $count++ < $maxcnt) |
|
120 | 120 | { |
121 | 121 | $row = $content->current(); |
122 | - $data[ $row[$codePos] ] = $row; |
|
122 | + $data[$row[$codePos]] = $row; |
|
123 | 123 | $content->next(); |
124 | 124 | } |
125 | 125 | |
@@ -175,21 +175,21 @@ discard block |
||
175 | 175 | * @param array $mapping List of domain item keys with the CSV field position as key |
176 | 176 | * @return array List of associative arrays containing the chunked properties |
177 | 177 | */ |
178 | - protected function getMappedChunk( array &$data, array $mapping ) |
|
178 | + protected function getMappedChunk(array &$data, array $mapping) |
|
179 | 179 | { |
180 | 180 | $idx = 0; |
181 | 181 | $map = []; |
182 | 182 | |
183 | - foreach( $mapping as $pos => $key ) |
|
183 | + foreach ($mapping as $pos => $key) |
|
184 | 184 | { |
185 | - if( isset( $map[$idx][$key] ) ) { |
|
185 | + if (isset($map[$idx][$key])) { |
|
186 | 186 | $idx++; |
187 | 187 | } |
188 | 188 | |
189 | - if( isset( $data[$pos] ) ) |
|
189 | + if (isset($data[$pos])) |
|
190 | 190 | { |
191 | 191 | $map[$idx][$key] = $data[$pos]; |
192 | - unset( $data[$pos] ); |
|
192 | + unset($data[$pos]); |
|
193 | 193 | } |
194 | 194 | } |
195 | 195 | |
@@ -203,37 +203,37 @@ discard block |
||
203 | 203 | * @param array $mappings Associative list of processor types as keys and index/data mappings as values |
204 | 204 | * @return \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface Processor object |
205 | 205 | */ |
206 | - protected function getProcessors( array $mappings ) |
|
206 | + protected function getProcessors(array $mappings) |
|
207 | 207 | { |
208 | 208 | $context = $this->getContext(); |
209 | 209 | $config = $context->getConfig(); |
210 | - $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Done( $context, [] ); |
|
210 | + $object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Done($context, []); |
|
211 | 211 | |
212 | - foreach( $mappings as $type => $mapping ) |
|
212 | + foreach ($mappings as $type => $mapping) |
|
213 | 213 | { |
214 | - if( ctype_alnum( $type ) === false ) |
|
214 | + if (ctype_alnum($type) === false) |
|
215 | 215 | { |
216 | 216 | $classname = is_string($type) ? '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Processor\\' . $type : '<not a string>'; |
217 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
217 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
218 | 218 | } |
219 | 219 | |
220 | - $name = $config->get( 'controller/common/catalog/import/csv/processor/' . $type . '/name', 'Standard' ); |
|
220 | + $name = $config->get('controller/common/catalog/import/csv/processor/' . $type . '/name', 'Standard'); |
|
221 | 221 | |
222 | - if( ctype_alnum( $name ) === false ) |
|
222 | + if (ctype_alnum($name) === false) |
|
223 | 223 | { |
224 | 224 | $classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Processor\\' . $type . '\\' . $name : '<not a string>'; |
225 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
225 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
226 | 226 | } |
227 | 227 | |
228 | - $classname = '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Processor\\' . ucfirst( $type ) . '\\' . $name; |
|
228 | + $classname = '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Processor\\' . ucfirst($type) . '\\' . $name; |
|
229 | 229 | |
230 | - if( class_exists( $classname ) === false ) { |
|
231 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) ); |
|
230 | + if (class_exists($classname) === false) { |
|
231 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not found', $classname)); |
|
232 | 232 | } |
233 | 233 | |
234 | - $object = new $classname( $context, $mapping, $object ); |
|
234 | + $object = new $classname($context, $mapping, $object); |
|
235 | 235 | |
236 | - \Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Processor\\Iface', $object ); |
|
236 | + \Aimeos\MW\Common\Base::checkClass('\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Processor\\Iface', $object); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | return $object; |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | * @param array $mapping Associative list of field position in CSV as key and domain item key as value |
33 | 33 | * @param \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $object Decorated processor |
34 | 34 | */ |
35 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
36 | - \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $object = null ) |
|
35 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
36 | + \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $object = null) |
|
37 | 37 | { |
38 | 38 | $this->context = $context; |
39 | 39 | $this->mapping = $mapping; |
@@ -48,13 +48,13 @@ discard block |
||
48 | 48 | * @param integer $pos Computed position of the list item in the associated list of items |
49 | 49 | * @return array Given associative list enriched by default values if they were not already set |
50 | 50 | */ |
51 | - protected function addListItemDefaults( array $list, $pos ) |
|
51 | + protected function addListItemDefaults(array $list, $pos) |
|
52 | 52 | { |
53 | - if( !isset( $list['catalog.lists.position'] ) ) { |
|
53 | + if (!isset($list['catalog.lists.position'])) { |
|
54 | 54 | $list['catalog.lists.position'] = $pos; |
55 | 55 | } |
56 | 56 | |
57 | - if( !isset( $list['catalog.lists.status'] ) ) { |
|
57 | + if (!isset($list['catalog.lists.status'])) { |
|
58 | 58 | $list['catalog.lists.status'] = 1; |
59 | 59 | } |
60 | 60 | |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | */ |
93 | 93 | protected function getObject() |
94 | 94 | { |
95 | - if( $this->object === null ) { |
|
96 | - throw new \Aimeos\Controller\Jobs\Exception( 'No processor object available' ); |
|
95 | + if ($this->object === null) { |
|
96 | + throw new \Aimeos\Controller\Jobs\Exception('No processor object available'); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | return $this->object; |
@@ -40,15 +40,15 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
42 | 42 | */ |
43 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context ) |
|
43 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context) |
|
44 | 44 | { |
45 | - parent::__construct( $context ); |
|
45 | + parent::__construct($context); |
|
46 | 46 | |
47 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'attribute' ); |
|
48 | - $result = $manager->searchItems( $manager->createSearch() ); |
|
47 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'attribute'); |
|
48 | + $result = $manager->searchItems($manager->createSearch()); |
|
49 | 49 | |
50 | - foreach( $result as $id => $item ) { |
|
51 | - $this->attributes[ $item->getCode() ][ $item->getType() ] = $item; |
|
50 | + foreach ($result as $id => $item) { |
|
51 | + $this->attributes[$item->getCode()][$item->getType()] = $item; |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
@@ -60,24 +60,24 @@ discard block |
||
60 | 60 | * @param string|null $type Attribute type |
61 | 61 | * @return \Aimeos\MShop\Attribute\Item\Iface|null Attribute object or null if not found |
62 | 62 | */ |
63 | - public function get( $code, $type = null ) |
|
63 | + public function get($code, $type = null) |
|
64 | 64 | { |
65 | - if( isset( $this->attributes[$code] ) && isset( $this->attributes[$code][$type] ) ) { |
|
65 | + if (isset($this->attributes[$code]) && isset($this->attributes[$code][$type])) { |
|
66 | 66 | return $this->attributes[$code][$type]; |
67 | 67 | } |
68 | 68 | |
69 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' ); |
|
69 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute'); |
|
70 | 70 | |
71 | 71 | $search = $manager->createSearch(); |
72 | 72 | $expr = array( |
73 | - $search->compare( '==', 'attribute.code', $code ), |
|
74 | - $search->compare( '==', 'attribute.type', $type ), |
|
73 | + $search->compare('==', 'attribute.code', $code), |
|
74 | + $search->compare('==', 'attribute.type', $type), |
|
75 | 75 | ); |
76 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
76 | + $search->setConditions($search->combine('&&', $expr)); |
|
77 | 77 | |
78 | - $result = $manager->searchItems( $search ); |
|
78 | + $result = $manager->searchItems($search); |
|
79 | 79 | |
80 | - if( ( $item = reset( $result ) ) !== false ) |
|
80 | + if (($item = reset($result)) !== false) |
|
81 | 81 | { |
82 | 82 | $this->attributes[$code][$type] = $item; |
83 | 83 | return $item; |
@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @param \Aimeos\MShop\Common\Item\Iface $item Attribute object |
92 | 92 | */ |
93 | - public function set( \Aimeos\MShop\Common\Item\Iface $item ) |
|
93 | + public function set(\Aimeos\MShop\Common\Item\Iface $item) |
|
94 | 94 | { |
95 | 95 | $code = $item->getCode(); |
96 | 96 | |
97 | - if( !isset( $this->attributes[$code] ) || !is_array( $this->attributes[$code] ) ) { |
|
97 | + if (!isset($this->attributes[$code]) || !is_array($this->attributes[$code])) { |
|
98 | 98 | $this->attributes[$code] = []; |
99 | 99 | } |
100 | 100 | |
101 | - $this->attributes[$code][ $item->getType() ] = $item; |
|
101 | + $this->attributes[$code][$item->getType()] = $item; |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | \ No newline at end of file |
@@ -27,14 +27,14 @@ discard block |
||
27 | 27 | * @param array $data Associative list of product codes and lists of CSV field indexes and their data |
28 | 28 | * @return array Associative list of CSV field indexes and their converted data |
29 | 29 | */ |
30 | - protected function convertData( array $convlist, array $data ) |
|
30 | + protected function convertData(array $convlist, array $data) |
|
31 | 31 | { |
32 | - foreach( $convlist as $idx => $converter ) |
|
32 | + foreach ($convlist as $idx => $converter) |
|
33 | 33 | { |
34 | - foreach( $data as $code => $list ) |
|
34 | + foreach ($data as $code => $list) |
|
35 | 35 | { |
36 | - if( isset( $list[$idx] ) ) { |
|
37 | - $data[$code][$idx] = $converter->translate( $list[$idx] ); |
|
36 | + if (isset($list[$idx])) { |
|
37 | + $data[$code][$idx] = $converter->translate($list[$idx]); |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | } |
@@ -50,36 +50,36 @@ discard block |
||
50 | 50 | * @param string|null Name of the cache implementation |
51 | 51 | * @return \Aimeos\Controller\Common\Product\Import\Csv\Cache\Iface Cache object |
52 | 52 | */ |
53 | - protected function getCache( $type, $name = null ) |
|
53 | + protected function getCache($type, $name = null) |
|
54 | 54 | { |
55 | 55 | $context = $this->getContext(); |
56 | 56 | $config = $context->getConfig(); |
57 | 57 | |
58 | - if( ctype_alnum( $type ) === false ) |
|
58 | + if (ctype_alnum($type) === false) |
|
59 | 59 | { |
60 | 60 | $classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\' . $type : '<not a string>'; |
61 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
61 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
62 | 62 | } |
63 | 63 | |
64 | - if( $name === null ) { |
|
65 | - $name = $config->get( 'controller/common/product/import/csv/cache/' . $type . '/name', 'Standard' ); |
|
64 | + if ($name === null) { |
|
65 | + $name = $config->get('controller/common/product/import/csv/cache/' . $type . '/name', 'Standard'); |
|
66 | 66 | } |
67 | 67 | |
68 | - if( ctype_alnum( $name ) === false ) |
|
68 | + if (ctype_alnum($name) === false) |
|
69 | 69 | { |
70 | 70 | $classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\' . $type . '\\' . $name : '<not a string>'; |
71 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
71 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
72 | 72 | } |
73 | 73 | |
74 | - $classname = '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\' . ucfirst( $type ) . '\\' . $name; |
|
74 | + $classname = '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\' . ucfirst($type) . '\\' . $name; |
|
75 | 75 | |
76 | - if( class_exists( $classname ) === false ) { |
|
77 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) ); |
|
76 | + if (class_exists($classname) === false) { |
|
77 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not found', $classname)); |
|
78 | 78 | } |
79 | 79 | |
80 | - $object = new $classname( $context ); |
|
80 | + $object = new $classname($context); |
|
81 | 81 | |
82 | - \Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\Iface', $object ); |
|
82 | + \Aimeos\MW\Common\Base::checkClass('\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\Iface', $object); |
|
83 | 83 | |
84 | 84 | return $object; |
85 | 85 | } |
@@ -91,12 +91,12 @@ discard block |
||
91 | 91 | * @param array $convmap List of converter names for the values at the position in the CSV file |
92 | 92 | * @return array Associative list of positions and converter objects |
93 | 93 | */ |
94 | - protected function getConverterList( array $convmap ) |
|
94 | + protected function getConverterList(array $convmap) |
|
95 | 95 | { |
96 | 96 | $convlist = []; |
97 | 97 | |
98 | - foreach( $convmap as $idx => $name ) { |
|
99 | - $convlist[$idx] = \Aimeos\MW\Convert\Factory::createConverter( $name ); |
|
98 | + foreach ($convmap as $idx => $name) { |
|
99 | + $convlist[$idx] = \Aimeos\MW\Convert\Factory::createConverter($name); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | return $convlist; |
@@ -111,15 +111,15 @@ discard block |
||
111 | 111 | * @param integer $codePos Column position which contains the unique product code (starting from 0) |
112 | 112 | * @return array List of arrays with product codes as keys and list of values from the CSV file |
113 | 113 | */ |
114 | - protected function getData( \Aimeos\MW\Container\Content\Iface $content, $maxcnt, $codePos ) |
|
114 | + protected function getData(\Aimeos\MW\Container\Content\Iface $content, $maxcnt, $codePos) |
|
115 | 115 | { |
116 | 116 | $count = 0; |
117 | 117 | $data = []; |
118 | 118 | |
119 | - while( $content->valid() && $count++ < $maxcnt ) |
|
119 | + while ($content->valid() && $count++ < $maxcnt) |
|
120 | 120 | { |
121 | 121 | $row = $content->current(); |
122 | - $data[ $row[$codePos] ] = $row; |
|
122 | + $data[$row[$codePos]] = $row; |
|
123 | 123 | $content->next(); |
124 | 124 | } |
125 | 125 | |
@@ -218,21 +218,21 @@ discard block |
||
218 | 218 | * @param array $mapping List of domain item keys with the CSV field position as key |
219 | 219 | * @return array List of associative arrays containing the chunked properties |
220 | 220 | */ |
221 | - protected function getMappedChunk( array &$data, array $mapping ) |
|
221 | + protected function getMappedChunk(array &$data, array $mapping) |
|
222 | 222 | { |
223 | 223 | $idx = 0; |
224 | 224 | $map = []; |
225 | 225 | |
226 | - foreach( $mapping as $pos => $key ) |
|
226 | + foreach ($mapping as $pos => $key) |
|
227 | 227 | { |
228 | - if( isset( $map[$idx][$key] ) ) { |
|
228 | + if (isset($map[$idx][$key])) { |
|
229 | 229 | $idx++; |
230 | 230 | } |
231 | 231 | |
232 | - if( isset( $data[$pos] ) ) |
|
232 | + if (isset($data[$pos])) |
|
233 | 233 | { |
234 | 234 | $map[$idx][$key] = $data[$pos]; |
235 | - unset( $data[$pos] ); |
|
235 | + unset($data[$pos]); |
|
236 | 236 | } |
237 | 237 | } |
238 | 238 | |
@@ -246,37 +246,37 @@ discard block |
||
246 | 246 | * @param array $mappings Associative list of processor types as keys and index/data mappings as values |
247 | 247 | * @return \Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface Processor object |
248 | 248 | */ |
249 | - protected function getProcessors( array $mappings ) |
|
249 | + protected function getProcessors(array $mappings) |
|
250 | 250 | { |
251 | 251 | $context = $this->getContext(); |
252 | 252 | $config = $context->getConfig(); |
253 | - $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done( $context, [] ); |
|
253 | + $object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done($context, []); |
|
254 | 254 | |
255 | - foreach( $mappings as $type => $mapping ) |
|
255 | + foreach ($mappings as $type => $mapping) |
|
256 | 256 | { |
257 | - if( ctype_alnum( $type ) === false ) |
|
257 | + if (ctype_alnum($type) === false) |
|
258 | 258 | { |
259 | 259 | $classname = is_string($type) ? '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\' . $type : '<not a string>'; |
260 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
260 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
261 | 261 | } |
262 | 262 | |
263 | - $name = $config->get( 'controller/common/product/import/csv/processor/' . $type . '/name', 'Standard' ); |
|
263 | + $name = $config->get('controller/common/product/import/csv/processor/' . $type . '/name', 'Standard'); |
|
264 | 264 | |
265 | - if( ctype_alnum( $name ) === false ) |
|
265 | + if (ctype_alnum($name) === false) |
|
266 | 266 | { |
267 | 267 | $classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\' . $type . '\\' . $name : '<not a string>'; |
268 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
268 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
269 | 269 | } |
270 | 270 | |
271 | - $classname = '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\' . ucfirst( $type ) . '\\' . $name; |
|
271 | + $classname = '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\' . ucfirst($type) . '\\' . $name; |
|
272 | 272 | |
273 | - if( class_exists( $classname ) === false ) { |
|
274 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) ); |
|
273 | + if (class_exists($classname) === false) { |
|
274 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not found', $classname)); |
|
275 | 275 | } |
276 | 276 | |
277 | - $object = new $classname( $context, $mapping, $object ); |
|
277 | + $object = new $classname($context, $mapping, $object); |
|
278 | 278 | |
279 | - \Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\Iface', $object ); |
|
279 | + \Aimeos\MW\Common\Base::checkClass('\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\Iface', $object); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | return $object; |
@@ -290,17 +290,17 @@ discard block |
||
290 | 290 | * @param array $domains List of domains whose items should be fetched too |
291 | 291 | * @return array Associative list of product codes as key and product items as value |
292 | 292 | */ |
293 | - protected function getProducts( array $codes, array $domains ) |
|
293 | + protected function getProducts(array $codes, array $domains) |
|
294 | 294 | { |
295 | 295 | $result = []; |
296 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' ); |
|
296 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product'); |
|
297 | 297 | |
298 | 298 | $search = $manager->createSearch(); |
299 | - $search->setConditions( $search->compare( '==', 'product.code', $codes ) ); |
|
300 | - $search->setSlice( 0, count( $codes ) ); |
|
299 | + $search->setConditions($search->compare('==', 'product.code', $codes)); |
|
300 | + $search->setSlice(0, count($codes)); |
|
301 | 301 | |
302 | - foreach( $manager->searchItems( $search, $domains ) as $item ) { |
|
303 | - $result[ $item->getCode() ] = $item; |
|
302 | + foreach ($manager->searchItems($search, $domains) as $item) { |
|
303 | + $result[$item->getCode()] = $item; |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | return $result; |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | * @param array $mapping Associative list of field position in CSV as key and domain item key as value |
33 | 33 | * @param \Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $object Decorated processor |
34 | 34 | */ |
35 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
36 | - \Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $object = null ) |
|
35 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
36 | + \Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $object = null) |
|
37 | 37 | { |
38 | 38 | $this->context = $context; |
39 | 39 | $this->mapping = $mapping; |
@@ -48,13 +48,13 @@ discard block |
||
48 | 48 | * @param integer $pos Computed position of the list item in the associated list of items |
49 | 49 | * @return array Given associative list enriched by default values if they were not already set |
50 | 50 | */ |
51 | - protected function addListItemDefaults( array $list, $pos ) |
|
51 | + protected function addListItemDefaults(array $list, $pos) |
|
52 | 52 | { |
53 | - if( !isset( $list['product.lists.position'] ) ) { |
|
53 | + if (!isset($list['product.lists.position'])) { |
|
54 | 54 | $list['product.lists.position'] = $pos; |
55 | 55 | } |
56 | 56 | |
57 | - if( !isset( $list['product.lists.status'] ) ) { |
|
57 | + if (!isset($list['product.lists.status'])) { |
|
58 | 58 | $list['product.lists.status'] = 1; |
59 | 59 | } |
60 | 60 | |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | */ |
93 | 93 | protected function getObject() |
94 | 94 | { |
95 | - if( $this->object === null ) { |
|
96 | - throw new \Aimeos\Controller\Jobs\Exception( 'No processor object available' ); |
|
95 | + if ($this->object === null) { |
|
96 | + throw new \Aimeos\Controller\Jobs\Exception('No processor object available'); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | return $this->object; |
@@ -9,10 +9,10 @@ discard block |
||
9 | 9 | |
10 | 10 | ?> |
11 | 11 | <productlist> |
12 | - <?php foreach( $this->get( 'exportItems', [] ) as $id => $item ) : ?> |
|
12 | + <?php foreach ($this->get('exportItems', []) as $id => $item) : ?> |
|
13 | 13 | |
14 | - <product-content id="<?php echo $enc->attr( $id ); ?>" > |
|
15 | - <productitem id="<?php echo $enc->attr( $id ); ?>" siteid="<?php echo $enc->attr( $item->getSiteId() ); ?>" ctime="<?php echo $enc->attr( $item->getTimeCreated() ); ?>" mtime="<?php echo $enc->attr( $item->getTimeModified() ); ?>" editor="<?php echo $enc->attr( $item->getEditor() ); ?>"> |
|
14 | + <product-content id="<?php echo $enc->attr($id); ?>" > |
|
15 | + <productitem id="<?php echo $enc->attr($id); ?>" siteid="<?php echo $enc->attr($item->getSiteId()); ?>" ctime="<?php echo $enc->attr($item->getTimeCreated()); ?>" mtime="<?php echo $enc->attr($item->getTimeModified()); ?>" editor="<?php echo $enc->attr($item->getEditor()); ?>"> |
|
16 | 16 | <type><![CDATA[<?php echo $item->getType(); ?>]]></type> |
17 | 17 | <code><![CDATA[<?php echo $item->getCode(); ?>]]></code> |
18 | 18 | <label><![CDATA[<?php echo $item->getCode(); ?>]]></label> |
@@ -22,10 +22,10 @@ discard block |
||
22 | 22 | </productitem> |
23 | 23 | <list> |
24 | 24 | <text> |
25 | - <?php foreach( $item->getListItems( 'text' ) as $listItem ) : ?> |
|
25 | + <?php foreach ($item->getListItems('text') as $listItem) : ?> |
|
26 | 26 | <?php if ($refItem = $listItem->getRefItem()) { ?> |
27 | 27 | |
28 | - <textitem id="<?php echo $enc->attr( $refItem->getId() ); ?>" siteid="<?php echo $enc->attr( $refItem->getSiteId() ); ?>" ctime="<?php echo $enc->attr( $refItem->getTimeCreated() ); ?>" mtime="<?php echo $enc->attr( $refItem->getTimeModified() ); ?>" editor="<?php echo $enc->attr( $refItem->getEditor() ); ?>" list.id="<?php echo $enc->attr( $listItem->getId() ); ?>" list.siteid="<?php echo $enc->attr( $listItem->getSiteId() ); ?>" list.parentid="<?php echo $enc->attr( $listItem->getParentId() ); ?>" list.type="<?php echo $enc->attr( $listItem->getType() ); ?>" list.domain="<?php echo $enc->attr( $listItem->getDomain() ); ?>" list.config="<?php echo $enc->attr( json_encode( $listItem->getConfig() ) ); ?>" list.start="<?php echo $enc->attr( $listItem->getDateStart() ); ?>" list.end="<?php echo $enc->attr( $listItem->getDateEnd() ); ?>" list.position="<?php echo $enc->attr( $listItem->getPosition() ); ?>" list.status="<?php echo $enc->attr( $listItem->getStatus() ); ?>" list.ctime="<?php echo $enc->attr( $listItem->getTimeCreated() ); ?>" list.mtime="<?php echo $enc->attr( $listItem->getTimeModified() ); ?>" list.editor="<?php echo $enc->attr( $listItem->getEditor() ); ?>"> |
|
28 | + <textitem id="<?php echo $enc->attr($refItem->getId()); ?>" siteid="<?php echo $enc->attr($refItem->getSiteId()); ?>" ctime="<?php echo $enc->attr($refItem->getTimeCreated()); ?>" mtime="<?php echo $enc->attr($refItem->getTimeModified()); ?>" editor="<?php echo $enc->attr($refItem->getEditor()); ?>" list.id="<?php echo $enc->attr($listItem->getId()); ?>" list.siteid="<?php echo $enc->attr($listItem->getSiteId()); ?>" list.parentid="<?php echo $enc->attr($listItem->getParentId()); ?>" list.type="<?php echo $enc->attr($listItem->getType()); ?>" list.domain="<?php echo $enc->attr($listItem->getDomain()); ?>" list.config="<?php echo $enc->attr(json_encode($listItem->getConfig())); ?>" list.start="<?php echo $enc->attr($listItem->getDateStart()); ?>" list.end="<?php echo $enc->attr($listItem->getDateEnd()); ?>" list.position="<?php echo $enc->attr($listItem->getPosition()); ?>" list.status="<?php echo $enc->attr($listItem->getStatus()); ?>" list.ctime="<?php echo $enc->attr($listItem->getTimeCreated()); ?>" list.mtime="<?php echo $enc->attr($listItem->getTimeModified()); ?>" list.editor="<?php echo $enc->attr($listItem->getEditor()); ?>"> |
|
29 | 29 | <type><![CDATA[<?php echo $refItem->getType(); ?>]]></type> |
30 | 30 | <languageid><![CDATA[<?php echo $refItem->getLanguageId(); ?>]]></languageid> |
31 | 31 | <label><![CDATA[<?php echo $refItem->getLabel(); ?>]]></label> |
@@ -37,10 +37,10 @@ discard block |
||
37 | 37 | |
38 | 38 | </text> |
39 | 39 | <media> |
40 | - <?php foreach( $item->getListItems( 'media' ) as $listItem ) : ?> |
|
40 | + <?php foreach ($item->getListItems('media') as $listItem) : ?> |
|
41 | 41 | <?php if ($refItem = $listItem->getRefItem()) { ?> |
42 | 42 | |
43 | - <mediaitem id="<?php echo $enc->attr( $refItem->getId() ); ?>" siteid="<?php echo $enc->attr( $refItem->getSiteId() ); ?>" ctime="<?php echo $enc->attr( $refItem->getTimeCreated() ); ?>" mtime="<?php echo $enc->attr( $refItem->getTimeModified() ); ?>" editor="<?php echo $enc->attr( $refItem->getEditor() ); ?>" list.id="<?php echo $enc->attr( $listItem->getId() ); ?>" list.siteid="<?php echo $enc->attr( $listItem->getSiteId() ); ?>" list.parentid="<?php echo $enc->attr( $listItem->getParentId() ); ?>" list.type="<?php echo $enc->attr( $listItem->getType() ); ?>" list.config="<?php echo $enc->attr( json_encode( $listItem->getConfig() ) ); ?>" list.start="<?php echo $enc->attr( $listItem->getDateStart() ); ?>" list.end="<?php echo $enc->attr( $listItem->getDateEnd() ); ?>" list.position="<?php echo $enc->attr( $listItem->getPosition() ); ?>" list.status="<?php echo $enc->attr( $listItem->getStatus() ); ?>" list.ctime="<?php echo $enc->attr( $listItem->getTimeCreated() ); ?>" list.mtime="<?php echo $enc->attr( $listItem->getTimeModified() ); ?>" list.editor="<?php echo $enc->attr( $listItem->getEditor() ); ?>"> |
|
43 | + <mediaitem id="<?php echo $enc->attr($refItem->getId()); ?>" siteid="<?php echo $enc->attr($refItem->getSiteId()); ?>" ctime="<?php echo $enc->attr($refItem->getTimeCreated()); ?>" mtime="<?php echo $enc->attr($refItem->getTimeModified()); ?>" editor="<?php echo $enc->attr($refItem->getEditor()); ?>" list.id="<?php echo $enc->attr($listItem->getId()); ?>" list.siteid="<?php echo $enc->attr($listItem->getSiteId()); ?>" list.parentid="<?php echo $enc->attr($listItem->getParentId()); ?>" list.type="<?php echo $enc->attr($listItem->getType()); ?>" list.config="<?php echo $enc->attr(json_encode($listItem->getConfig())); ?>" list.start="<?php echo $enc->attr($listItem->getDateStart()); ?>" list.end="<?php echo $enc->attr($listItem->getDateEnd()); ?>" list.position="<?php echo $enc->attr($listItem->getPosition()); ?>" list.status="<?php echo $enc->attr($listItem->getStatus()); ?>" list.ctime="<?php echo $enc->attr($listItem->getTimeCreated()); ?>" list.mtime="<?php echo $enc->attr($listItem->getTimeModified()); ?>" list.editor="<?php echo $enc->attr($listItem->getEditor()); ?>"> |
|
44 | 44 | <type><![CDATA[<?php echo $refItem->getType(); ?>]]></type> |
45 | 45 | <languageid><![CDATA[<?php echo $refItem->getLanguageId(); ?>]]></languageid> |
46 | 46 | <label><![CDATA[<?php echo $refItem->getLabel(); ?>]]></label> |
@@ -54,10 +54,10 @@ discard block |
||
54 | 54 | |
55 | 55 | </media> |
56 | 56 | <price> |
57 | - <?php foreach( $item->getListItems( 'price' ) as $listItem ) : ?> |
|
57 | + <?php foreach ($item->getListItems('price') as $listItem) : ?> |
|
58 | 58 | <?php if ($refItem = $listItem->getRefItem()) { ?> |
59 | 59 | |
60 | - <priceitem id="<?php echo $enc->attr( $refItem->getId() ); ?>" siteid="<?php echo $enc->attr( $refItem->getSiteId() ); ?>" ctime="<?php echo $enc->attr( $refItem->getTimeCreated() ); ?>" mtime="<?php echo $enc->attr( $refItem->getTimeModified() ); ?>" editor="<?php echo $enc->attr( $refItem->getEditor() ); ?>" list.id="<?php echo $enc->attr( $listItem->getId() ); ?>" list.siteid="<?php echo $enc->attr( $listItem->getSiteId() ); ?>" list.parentid="<?php echo $enc->attr( $listItem->getParentId() ); ?>" list.type="<?php echo $enc->attr( $listItem->getType() ); ?>" list.config="<?php echo $enc->attr( json_encode( $listItem->getConfig() ) ); ?>" list.start="<?php echo $enc->attr( $listItem->getDateStart() ); ?>" list.end="<?php echo $enc->attr( $listItem->getDateEnd() ); ?>" list.position="<?php echo $enc->attr( $listItem->getPosition() ); ?>" list.status="<?php echo $enc->attr( $listItem->getStatus() ); ?>" list.ctime="<?php echo $enc->attr( $listItem->getTimeCreated() ); ?>" list.mtime="<?php echo $enc->attr( $listItem->getTimeModified() ); ?>" list.editor="<?php echo $enc->attr( $listItem->getEditor() ); ?>"> |
|
60 | + <priceitem id="<?php echo $enc->attr($refItem->getId()); ?>" siteid="<?php echo $enc->attr($refItem->getSiteId()); ?>" ctime="<?php echo $enc->attr($refItem->getTimeCreated()); ?>" mtime="<?php echo $enc->attr($refItem->getTimeModified()); ?>" editor="<?php echo $enc->attr($refItem->getEditor()); ?>" list.id="<?php echo $enc->attr($listItem->getId()); ?>" list.siteid="<?php echo $enc->attr($listItem->getSiteId()); ?>" list.parentid="<?php echo $enc->attr($listItem->getParentId()); ?>" list.type="<?php echo $enc->attr($listItem->getType()); ?>" list.config="<?php echo $enc->attr(json_encode($listItem->getConfig())); ?>" list.start="<?php echo $enc->attr($listItem->getDateStart()); ?>" list.end="<?php echo $enc->attr($listItem->getDateEnd()); ?>" list.position="<?php echo $enc->attr($listItem->getPosition()); ?>" list.status="<?php echo $enc->attr($listItem->getStatus()); ?>" list.ctime="<?php echo $enc->attr($listItem->getTimeCreated()); ?>" list.mtime="<?php echo $enc->attr($listItem->getTimeModified()); ?>" list.editor="<?php echo $enc->attr($listItem->getEditor()); ?>"> |
|
61 | 61 | <type><![CDATA[<?php echo $refItem->getType(); ?>]]></type> |
62 | 62 | <currencyid><![CDATA[<?php echo $refItem->getCurrencyId(); ?>]]></currencyid> |
63 | 63 | <quantity><![CDATA[<?php echo $refItem->getQuantity(); ?>]]></quantity> |
@@ -73,10 +73,10 @@ discard block |
||
73 | 73 | |
74 | 74 | </price> |
75 | 75 | <attribute> |
76 | - <?php foreach( $item->getListItems( 'attribute' ) as $listItem ) : ?> |
|
76 | + <?php foreach ($item->getListItems('attribute') as $listItem) : ?> |
|
77 | 77 | <?php if ($refItem = $listItem->getRefItem()) { ?> |
78 | 78 | |
79 | - <attributeitem id="<?php echo $enc->attr( $refItem->getId() ); ?>" siteid="<?php echo $enc->attr( $refItem->getSiteId() ); ?>" ctime="<?php echo $enc->attr( $refItem->getTimeCreated() ); ?>" mtime="<?php echo $enc->attr( $refItem->getTimeModified() ); ?>" editor="<?php echo $enc->attr( $refItem->getEditor() ); ?>" list.id="<?php echo $enc->attr( $listItem->getId() ); ?>" list.siteid="<?php echo $enc->attr( $listItem->getSiteId() ); ?>" list.parentid="<?php echo $enc->attr( $listItem->getParentId() ); ?>" list.type="<?php echo $enc->attr( $listItem->getType() ); ?>" list.config="<?php echo $enc->attr( json_encode( $listItem->getConfig() ) ); ?>" list.start="<?php echo $enc->attr( $listItem->getDateStart() ); ?>" list.end="<?php echo $enc->attr( $listItem->getDateEnd() ); ?>" list.position="<?php echo $enc->attr( $listItem->getPosition() ); ?>" list.status="<?php echo $enc->attr( $listItem->getStatus() ); ?>" list.ctime="<?php echo $enc->attr( $listItem->getTimeCreated() ); ?>" list.mtime="<?php echo $enc->attr( $listItem->getTimeModified() ); ?>" list.editor="<?php echo $enc->attr( $listItem->getEditor() ); ?>"> |
|
79 | + <attributeitem id="<?php echo $enc->attr($refItem->getId()); ?>" siteid="<?php echo $enc->attr($refItem->getSiteId()); ?>" ctime="<?php echo $enc->attr($refItem->getTimeCreated()); ?>" mtime="<?php echo $enc->attr($refItem->getTimeModified()); ?>" editor="<?php echo $enc->attr($refItem->getEditor()); ?>" list.id="<?php echo $enc->attr($listItem->getId()); ?>" list.siteid="<?php echo $enc->attr($listItem->getSiteId()); ?>" list.parentid="<?php echo $enc->attr($listItem->getParentId()); ?>" list.type="<?php echo $enc->attr($listItem->getType()); ?>" list.config="<?php echo $enc->attr(json_encode($listItem->getConfig())); ?>" list.start="<?php echo $enc->attr($listItem->getDateStart()); ?>" list.end="<?php echo $enc->attr($listItem->getDateEnd()); ?>" list.position="<?php echo $enc->attr($listItem->getPosition()); ?>" list.status="<?php echo $enc->attr($listItem->getStatus()); ?>" list.ctime="<?php echo $enc->attr($listItem->getTimeCreated()); ?>" list.mtime="<?php echo $enc->attr($listItem->getTimeModified()); ?>" list.editor="<?php echo $enc->attr($listItem->getEditor()); ?>"> |
|
80 | 80 | <type><![CDATA[<?php echo $refItem->getType(); ?>]]></type> |
81 | 81 | <code><![CDATA[<?php echo $refItem->getCode(); ?>]]></code> |
82 | 82 | <label><![CDATA[<?php echo $refItem->getLabel(); ?>]]></label> |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | |
89 | 89 | </attribute> |
90 | 90 | <product> |
91 | - <?php foreach( $item->getListItems( 'product' ) as $listItem ) : ?> |
|
91 | + <?php foreach ($item->getListItems('product') as $listItem) : ?> |
|
92 | 92 | <?php if ($refItem = $listItem->getRefItem()) { ?> |
93 | 93 | |
94 | - <productitem id="<?php echo $enc->attr( $refItem->getId() ); ?>" siteid="<?php echo $enc->attr( $refItem->getSiteId() ); ?>" ctime="<?php echo $enc->attr( $refItem->getTimeCreated() ); ?>" mtime="<?php echo $enc->attr( $refItem->getTimeModified() ); ?>" editor="<?php echo $enc->attr( $refItem->getEditor() ); ?>" list.id="<?php echo $enc->attr( $listItem->getId() ); ?>" list.siteid="<?php echo $enc->attr( $listItem->getSiteId() ); ?>" list.parentid="<?php echo $enc->attr( $listItem->getParentId() ); ?>" list.type="<?php echo $enc->attr( $listItem->getType() ); ?>" list.config="<?php echo $enc->attr( json_encode( $listItem->getConfig() ) ); ?>" list.start="<?php echo $enc->attr( $listItem->getDateStart() ); ?>" list.end="<?php echo $enc->attr( $listItem->getDateEnd() ); ?>" list.position="<?php echo $enc->attr( $listItem->getPosition() ); ?>" list.status="<?php echo $enc->attr( $listItem->getStatus() ); ?>" list.ctime="<?php echo $enc->attr( $listItem->getTimeCreated() ); ?>" list.mtime="<?php echo $enc->attr( $listItem->getTimeModified() ); ?>" list.editor="<?php echo $enc->attr( $listItem->getEditor() ); ?>"> |
|
94 | + <productitem id="<?php echo $enc->attr($refItem->getId()); ?>" siteid="<?php echo $enc->attr($refItem->getSiteId()); ?>" ctime="<?php echo $enc->attr($refItem->getTimeCreated()); ?>" mtime="<?php echo $enc->attr($refItem->getTimeModified()); ?>" editor="<?php echo $enc->attr($refItem->getEditor()); ?>" list.id="<?php echo $enc->attr($listItem->getId()); ?>" list.siteid="<?php echo $enc->attr($listItem->getSiteId()); ?>" list.parentid="<?php echo $enc->attr($listItem->getParentId()); ?>" list.type="<?php echo $enc->attr($listItem->getType()); ?>" list.config="<?php echo $enc->attr(json_encode($listItem->getConfig())); ?>" list.start="<?php echo $enc->attr($listItem->getDateStart()); ?>" list.end="<?php echo $enc->attr($listItem->getDateEnd()); ?>" list.position="<?php echo $enc->attr($listItem->getPosition()); ?>" list.status="<?php echo $enc->attr($listItem->getStatus()); ?>" list.ctime="<?php echo $enc->attr($listItem->getTimeCreated()); ?>" list.mtime="<?php echo $enc->attr($listItem->getTimeModified()); ?>" list.editor="<?php echo $enc->attr($listItem->getEditor()); ?>"> |
|
95 | 95 | <type><![CDATA[<?php echo $item->getType(); ?>]]></type> |
96 | 96 | <code><![CDATA[<?php echo $item->getCode(); ?>]]></code> |
97 | 97 | <label><![CDATA[<?php echo $item->getCode(); ?>]]></label> |
@@ -18,119 +18,119 @@ discard block |
||
18 | 18 | |
19 | 19 | protected function setUp() |
20 | 20 | { |
21 | - \Aimeos\MShop\Factory::setCache( true ); |
|
21 | + \Aimeos\MShop\Factory::setCache(true); |
|
22 | 22 | |
23 | 23 | $this->context = \TestHelperJobs::getContext(); |
24 | 24 | $this->aimeos = \TestHelperJobs::getAimeos(); |
25 | 25 | $config = $this->context->getConfig(); |
26 | 26 | |
27 | - $config->set( 'controller/jobs/product/import/csv/skip-lines', 1 ); |
|
28 | - $config->set( 'controller/jobs/product/import/csv/location', __DIR__ . '/_testfiles/valid' ); |
|
27 | + $config->set('controller/jobs/product/import/csv/skip-lines', 1); |
|
28 | + $config->set('controller/jobs/product/import/csv/location', __DIR__ . '/_testfiles/valid'); |
|
29 | 29 | |
30 | - $this->object = new \Aimeos\Controller\Jobs\Product\Import\Csv\Standard( $this->context, $this->aimeos ); |
|
30 | + $this->object = new \Aimeos\Controller\Jobs\Product\Import\Csv\Standard($this->context, $this->aimeos); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
34 | 34 | protected function tearDown() |
35 | 35 | { |
36 | - \Aimeos\MShop\Factory::setCache( false ); |
|
36 | + \Aimeos\MShop\Factory::setCache(false); |
|
37 | 37 | \Aimeos\MShop\Factory::clear(); |
38 | 38 | |
39 | 39 | $this->object = null; |
40 | 40 | |
41 | - if( file_exists( 'tmp/import.zip' ) ) { |
|
42 | - unlink( 'tmp/import.zip' ); |
|
41 | + if (file_exists('tmp/import.zip')) { |
|
42 | + unlink('tmp/import.zip'); |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | |
46 | 46 | |
47 | 47 | public function testGetName() |
48 | 48 | { |
49 | - $this->assertEquals( 'Product import CSV', $this->object->getName() ); |
|
49 | + $this->assertEquals('Product import CSV', $this->object->getName()); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
53 | 53 | public function testGetDescription() |
54 | 54 | { |
55 | 55 | $text = 'Imports new and updates existing products from CSV files'; |
56 | - $this->assertEquals( $text, $this->object->getDescription() ); |
|
56 | + $this->assertEquals($text, $this->object->getDescription()); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
60 | 60 | public function testRun() |
61 | 61 | { |
62 | - $prodcodes = array( 'job_csv_test', 'job_csv_test2' ); |
|
63 | - $nondelete = array( 'attribute', 'product' ); |
|
64 | - $delete = array( 'media', 'price', 'text' ); |
|
62 | + $prodcodes = array('job_csv_test', 'job_csv_test2'); |
|
63 | + $nondelete = array('attribute', 'product'); |
|
64 | + $delete = array('media', 'price', 'text'); |
|
65 | 65 | |
66 | 66 | $convert = array( |
67 | 67 | 1 => 'Text/LatinUTF8', |
68 | 68 | ); |
69 | 69 | |
70 | - $this->context->getConfig()->set( 'controller/jobs/product/import/csv/converter', $convert ); |
|
70 | + $this->context->getConfig()->set('controller/jobs/product/import/csv/converter', $convert); |
|
71 | 71 | |
72 | 72 | $this->object->run(); |
73 | 73 | |
74 | - $result = $this->get( $prodcodes, array_merge( $delete, $nondelete ) ); |
|
75 | - $properties = $this->getProperties( array_keys( $result ) ); |
|
76 | - $this->delete( $prodcodes, $delete, $nondelete ); |
|
74 | + $result = $this->get($prodcodes, array_merge($delete, $nondelete)); |
|
75 | + $properties = $this->getProperties(array_keys($result)); |
|
76 | + $this->delete($prodcodes, $delete, $nondelete); |
|
77 | 77 | |
78 | - $this->assertEquals( 2, count( $result ) ); |
|
79 | - $this->assertEquals( 2, count( $properties ) ); |
|
78 | + $this->assertEquals(2, count($result)); |
|
79 | + $this->assertEquals(2, count($properties)); |
|
80 | 80 | |
81 | - foreach( $result as $product ) { |
|
82 | - $this->assertEquals( 5, count( $product->getListItems() ) ); |
|
81 | + foreach ($result as $product) { |
|
82 | + $this->assertEquals(5, count($product->getListItems())); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | 86 | |
87 | 87 | public function testRunUpdate() |
88 | 88 | { |
89 | - $prodcodes = array( 'job_csv_test', 'job_csv_test2' ); |
|
90 | - $nondelete = array( 'attribute', 'product' ); |
|
91 | - $delete = array( 'media', 'price', 'text' ); |
|
89 | + $prodcodes = array('job_csv_test', 'job_csv_test2'); |
|
90 | + $nondelete = array('attribute', 'product'); |
|
91 | + $delete = array('media', 'price', 'text'); |
|
92 | 92 | |
93 | 93 | $this->object->run(); |
94 | 94 | $this->object->run(); |
95 | 95 | |
96 | - $result = $this->get( $prodcodes, array_merge( $delete, $nondelete ) ); |
|
97 | - $properties = $this->getProperties( array_keys( $result ) ); |
|
98 | - $this->delete( $prodcodes, $delete, $nondelete ); |
|
96 | + $result = $this->get($prodcodes, array_merge($delete, $nondelete)); |
|
97 | + $properties = $this->getProperties(array_keys($result)); |
|
98 | + $this->delete($prodcodes, $delete, $nondelete); |
|
99 | 99 | |
100 | - $this->assertEquals( 2, count( $result ) ); |
|
101 | - $this->assertEquals( 2, count( $properties ) ); |
|
100 | + $this->assertEquals(2, count($result)); |
|
101 | + $this->assertEquals(2, count($properties)); |
|
102 | 102 | |
103 | - foreach( $result as $product ) { |
|
104 | - $this->assertEquals( 5, count( $product->getListItems() ) ); |
|
103 | + foreach ($result as $product) { |
|
104 | + $this->assertEquals(5, count($product->getListItems())); |
|
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
108 | 108 | |
109 | 109 | public function testRunPosition() |
110 | 110 | { |
111 | - $prodcodes = array( 'job_csv_test', 'job_csv_test2' ); |
|
112 | - $nondelete = array( 'attribute', 'product' ); |
|
113 | - $delete = array( 'media', 'price', 'text' ); |
|
111 | + $prodcodes = array('job_csv_test', 'job_csv_test2'); |
|
112 | + $nondelete = array('attribute', 'product'); |
|
113 | + $delete = array('media', 'price', 'text'); |
|
114 | 114 | |
115 | 115 | $config = $this->context->getConfig(); |
116 | - $mapping = $config->set( 'controller/jobs/product/import/csv/mapping', [] ); |
|
117 | - $mapping['item'] = array( 0 => 'product.label', 1 => 'product.code' ); |
|
116 | + $mapping = $config->set('controller/jobs/product/import/csv/mapping', []); |
|
117 | + $mapping['item'] = array(0 => 'product.label', 1 => 'product.code'); |
|
118 | 118 | |
119 | - $config->set( 'controller/jobs/product/import/csv/mapping', $mapping ); |
|
120 | - $config->set( 'controller/jobs/product/import/csv/location', __DIR__ . '/_testfiles/position' ); |
|
119 | + $config->set('controller/jobs/product/import/csv/mapping', $mapping); |
|
120 | + $config->set('controller/jobs/product/import/csv/location', __DIR__ . '/_testfiles/position'); |
|
121 | 121 | |
122 | 122 | $this->object->run(); |
123 | 123 | |
124 | - $result = $this->get( $prodcodes, array_merge( $delete, $nondelete ) ); |
|
125 | - $this->delete( $prodcodes, $delete, $nondelete ); |
|
124 | + $result = $this->get($prodcodes, array_merge($delete, $nondelete)); |
|
125 | + $this->delete($prodcodes, $delete, $nondelete); |
|
126 | 126 | |
127 | - $this->assertEquals( 2, count( $result ) ); |
|
127 | + $this->assertEquals(2, count($result)); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | |
131 | 131 | public function testRunProcessorInvalidPosition() |
132 | 132 | { |
133 | - $prodcodes = array( 'job_csv_test', 'job_csv_test2' ); |
|
133 | + $prodcodes = array('job_csv_test', 'job_csv_test2'); |
|
134 | 134 | |
135 | 135 | $mapping = array( |
136 | 136 | 'item' => array( |
@@ -150,11 +150,11 @@ discard block |
||
150 | 150 | ), |
151 | 151 | ); |
152 | 152 | |
153 | - $this->context->getConfig()->set( 'controller/jobs/product/import/csv/mapping', $mapping ); |
|
153 | + $this->context->getConfig()->set('controller/jobs/product/import/csv/mapping', $mapping); |
|
154 | 154 | |
155 | 155 | $this->object->run(); |
156 | 156 | |
157 | - $this->delete( $prodcodes, array( 'text', 'media' ), [] ); |
|
157 | + $this->delete($prodcodes, array('text', 'media'), []); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
@@ -166,9 +166,9 @@ discard block |
||
166 | 166 | ), |
167 | 167 | ); |
168 | 168 | |
169 | - $this->context->getConfig()->set( 'controller/jobs/product/import/csv/mapping', $mapping ); |
|
169 | + $this->context->getConfig()->set('controller/jobs/product/import/csv/mapping', $mapping); |
|
170 | 170 | |
171 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
171 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
172 | 172 | $this->object->run(); |
173 | 173 | } |
174 | 174 | |
@@ -208,15 +208,15 @@ discard block |
||
208 | 208 | ), |
209 | 209 | ); |
210 | 210 | |
211 | - $this->context->getConfig()->set( 'controller/jobs/product/import/csv/mapping', $mapping ); |
|
211 | + $this->context->getConfig()->set('controller/jobs/product/import/csv/mapping', $mapping); |
|
212 | 212 | |
213 | 213 | $config = $this->context->getConfig(); |
214 | - $config->set( 'controller/jobs/product/import/csv/skip-lines', 0 ); |
|
215 | - $config->set( 'controller/jobs/product/import/csv/location', __DIR__ . '/_testfiles/invalid' ); |
|
214 | + $config->set('controller/jobs/product/import/csv/skip-lines', 0); |
|
215 | + $config->set('controller/jobs/product/import/csv/location', __DIR__ . '/_testfiles/invalid'); |
|
216 | 216 | |
217 | - $this->object = new \Aimeos\Controller\Jobs\Product\Import\Csv\Standard( $this->context, $this->aimeos ); |
|
217 | + $this->object = new \Aimeos\Controller\Jobs\Product\Import\Csv\Standard($this->context, $this->aimeos); |
|
218 | 218 | |
219 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
219 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
220 | 220 | $this->object->run(); |
221 | 221 | } |
222 | 222 | |
@@ -224,104 +224,104 @@ discard block |
||
224 | 224 | public function testRunBackup() |
225 | 225 | { |
226 | 226 | $config = $this->context->getConfig(); |
227 | - $config->set( 'controller/jobs/product/import/csv/container/type', 'Zip' ); |
|
228 | - $config->set( 'controller/jobs/product/import/csv/location', 'tmp/import.zip' ); |
|
229 | - $config->set( 'controller/jobs/product/import/csv/backup', 'tmp/test-%Y-%m-%d.zip' ); |
|
227 | + $config->set('controller/jobs/product/import/csv/container/type', 'Zip'); |
|
228 | + $config->set('controller/jobs/product/import/csv/location', 'tmp/import.zip'); |
|
229 | + $config->set('controller/jobs/product/import/csv/backup', 'tmp/test-%Y-%m-%d.zip'); |
|
230 | 230 | |
231 | - if( copy( __DIR__ . '/_testfiles/import.zip', 'tmp/import.zip' ) === false ) { |
|
232 | - throw new \RuntimeException( 'Unable to copy test file' ); |
|
231 | + if (copy(__DIR__ . '/_testfiles/import.zip', 'tmp/import.zip') === false) { |
|
232 | + throw new \RuntimeException('Unable to copy test file'); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | $this->object->run(); |
236 | 236 | |
237 | - $filename = strftime( 'tmp/test-%Y-%m-%d.zip' ); |
|
238 | - $this->assertTrue( file_exists( $filename ) ); |
|
237 | + $filename = strftime('tmp/test-%Y-%m-%d.zip'); |
|
238 | + $this->assertTrue(file_exists($filename)); |
|
239 | 239 | |
240 | - unlink( $filename ); |
|
240 | + unlink($filename); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | |
244 | 244 | public function testRunBackupInvalid() |
245 | 245 | { |
246 | 246 | $config = $this->context->getConfig(); |
247 | - $config->set( 'controller/jobs/product/import/csv/container/type', 'Zip' ); |
|
248 | - $config->set( 'controller/jobs/product/import/csv/location', 'tmp/import.zip' ); |
|
249 | - $config->set( 'controller/jobs/product/import/csv/backup', 'tmp/notexist/import.zip' ); |
|
247 | + $config->set('controller/jobs/product/import/csv/container/type', 'Zip'); |
|
248 | + $config->set('controller/jobs/product/import/csv/location', 'tmp/import.zip'); |
|
249 | + $config->set('controller/jobs/product/import/csv/backup', 'tmp/notexist/import.zip'); |
|
250 | 250 | |
251 | - if( copy( __DIR__ . '/_testfiles/import.zip', 'tmp/import.zip' ) === false ) { |
|
252 | - throw new \RuntimeException( 'Unable to copy test file' ); |
|
251 | + if (copy(__DIR__ . '/_testfiles/import.zip', 'tmp/import.zip') === false) { |
|
252 | + throw new \RuntimeException('Unable to copy test file'); |
|
253 | 253 | } |
254 | 254 | |
255 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
255 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
256 | 256 | $this->object->run(); |
257 | 257 | } |
258 | 258 | |
259 | 259 | |
260 | - protected function delete( array $prodcodes, array $delete, array $nondelete ) |
|
260 | + protected function delete(array $prodcodes, array $delete, array $nondelete) |
|
261 | 261 | { |
262 | - $catListManager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( $this->context )->getSubmanager( 'lists' ); |
|
263 | - $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context ); |
|
264 | - $listManager = $productManager->getSubManager( 'lists' ); |
|
262 | + $catListManager = \Aimeos\MShop\Catalog\Manager\Factory::createManager($this->context)->getSubmanager('lists'); |
|
263 | + $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context); |
|
264 | + $listManager = $productManager->getSubManager('lists'); |
|
265 | 265 | |
266 | - foreach( $this->get( $prodcodes, $delete + $nondelete ) as $id => $product ) |
|
266 | + foreach ($this->get($prodcodes, $delete + $nondelete) as $id => $product) |
|
267 | 267 | { |
268 | - foreach( $delete as $domain ) |
|
268 | + foreach ($delete as $domain) |
|
269 | 269 | { |
270 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, $domain ); |
|
270 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, $domain); |
|
271 | 271 | |
272 | - foreach( $product->getListItems( $domain ) as $listItem ) |
|
272 | + foreach ($product->getListItems($domain) as $listItem) |
|
273 | 273 | { |
274 | - $manager->deleteItem( $listItem->getRefItem()->getId() ); |
|
275 | - $listManager->deleteItem( $listItem->getId() ); |
|
274 | + $manager->deleteItem($listItem->getRefItem()->getId()); |
|
275 | + $listManager->deleteItem($listItem->getId()); |
|
276 | 276 | } |
277 | 277 | } |
278 | 278 | |
279 | - foreach( $nondelete as $domain ) |
|
279 | + foreach ($nondelete as $domain) |
|
280 | 280 | { |
281 | - $ids = array_keys( $product->getListItems( $domain ) ); |
|
282 | - $listManager->deleteItems( $ids ); |
|
281 | + $ids = array_keys($product->getListItems($domain)); |
|
282 | + $listManager->deleteItems($ids); |
|
283 | 283 | } |
284 | 284 | |
285 | - $productManager->deleteItem( $product->getId() ); |
|
285 | + $productManager->deleteItem($product->getId()); |
|
286 | 286 | |
287 | 287 | $search = $catListManager->createSearch(); |
288 | - $search->setConditions( $search->compare( '==', 'catalog.lists.refid', $id ) ); |
|
289 | - $result = $catListManager->searchItems( $search ); |
|
288 | + $search->setConditions($search->compare('==', 'catalog.lists.refid', $id)); |
|
289 | + $result = $catListManager->searchItems($search); |
|
290 | 290 | |
291 | - $catListManager->deleteItems( array_keys( $result ) ); |
|
291 | + $catListManager->deleteItems(array_keys($result)); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | |
295 | - $attrManager = \Aimeos\MShop\Attribute\Manager\Factory::createManager( $this->context ); |
|
295 | + $attrManager = \Aimeos\MShop\Attribute\Manager\Factory::createManager($this->context); |
|
296 | 296 | |
297 | 297 | $search = $attrManager->createSearch(); |
298 | - $search->setConditions( $search->compare( '==', 'attribute.code', 'import-test' ) ); |
|
298 | + $search->setConditions($search->compare('==', 'attribute.code', 'import-test')); |
|
299 | 299 | |
300 | - $result = $attrManager->searchItems( $search ); |
|
300 | + $result = $attrManager->searchItems($search); |
|
301 | 301 | |
302 | - $attrManager->deleteItems( array_keys( $result ) ); |
|
302 | + $attrManager->deleteItems(array_keys($result)); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | |
306 | - protected function get( array $prodcodes, array $domains ) |
|
306 | + protected function get(array $prodcodes, array $domains) |
|
307 | 307 | { |
308 | - $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context ); |
|
308 | + $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context); |
|
309 | 309 | |
310 | 310 | $search = $productManager->createSearch(); |
311 | - $search->setConditions( $search->compare( '==', 'product.code', $prodcodes ) ); |
|
311 | + $search->setConditions($search->compare('==', 'product.code', $prodcodes)); |
|
312 | 312 | |
313 | - return $productManager->searchItems( $search, $domains ); |
|
313 | + return $productManager->searchItems($search, $domains); |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | |
317 | - protected function getProperties( array $prodids ) |
|
317 | + protected function getProperties(array $prodids) |
|
318 | 318 | { |
319 | - $manager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context )->getSubManager( 'property' ); |
|
319 | + $manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context)->getSubManager('property'); |
|
320 | 320 | |
321 | 321 | $search = $manager->createSearch(); |
322 | - $search->setConditions( $search->compare( '==', 'product.property.parentid', $prodids ) ); |
|
323 | - $search->setSortations( array( $search->sort( '+', 'product.property.type' ) ) ); |
|
322 | + $search->setConditions($search->compare('==', 'product.property.parentid', $prodids)); |
|
323 | + $search->setSortations(array($search->sort('+', 'product.property.type'))); |
|
324 | 324 | |
325 | - return $manager->searchItems( $search ); |
|
325 | + return $manager->searchItems($search); |
|
326 | 326 | } |
327 | 327 | } |
328 | 328 | \ No newline at end of file |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function getName() |
31 | 31 | { |
32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Products bought together' ); |
|
32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Products bought together'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function getDescription() |
42 | 42 | { |
43 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Creates bought together product suggestions' ); |
|
43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Creates bought together product suggestions'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @see controller/jobs/product/bought/min-confidence |
73 | 73 | * @see controller/jobs/product/bought/limit-days |
74 | 74 | */ |
75 | - $maxItems = $config->get( 'controller/jobs/product/bought/max-items', 5 ); |
|
75 | + $maxItems = $config->get('controller/jobs/product/bought/max-items', 5); |
|
76 | 76 | |
77 | 77 | /** controller/jobs/product/bought/min-support |
78 | 78 | * Minimum support value to sort out all irrelevant combinations |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @see controller/jobs/product/bought/min-confidence |
102 | 102 | * @see controller/jobs/product/bought/limit-days |
103 | 103 | */ |
104 | - $minSupport = $config->get( 'controller/jobs/product/bought/min-support', 0.02 ); |
|
104 | + $minSupport = $config->get('controller/jobs/product/bought/min-support', 0.02); |
|
105 | 105 | |
106 | 106 | /** controller/jobs/product/bought/min-confidence |
107 | 107 | * Minimum confidence value for high quality suggestions |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @see controller/jobs/product/bought/min-support |
127 | 127 | * @see controller/jobs/product/bought/limit-days |
128 | 128 | */ |
129 | - $minConfidence = $config->get( 'controller/jobs/product/bought/min-confidence', 0.66 ); |
|
129 | + $minConfidence = $config->get('controller/jobs/product/bought/min-confidence', 0.66); |
|
130 | 130 | |
131 | 131 | /** controller/jobs/product/bought/limit-days |
132 | 132 | * Only use orders placed in the past within the configured number of days for calculating bought together products |
@@ -150,43 +150,43 @@ discard block |
||
150 | 150 | * @see controller/jobs/product/bought/min-support |
151 | 151 | * @see controller/jobs/product/bought/min-confidence |
152 | 152 | */ |
153 | - $days = $config->get( 'controller/jobs/product/bought/limit-days', 180 ); |
|
154 | - $date = date( 'Y-m-d H:i:s', time() - $days * 86400 ); |
|
153 | + $days = $config->get('controller/jobs/product/bought/limit-days', 180); |
|
154 | + $date = date('Y-m-d H:i:s', time() - $days * 86400); |
|
155 | 155 | |
156 | 156 | |
157 | - $baseManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' ); |
|
157 | + $baseManager = \Aimeos\MShop\Factory::createManager($context, 'order/base'); |
|
158 | 158 | $search = $baseManager->createSearch(); |
159 | - $search->setConditions( $search->compare( '>', 'order.base.ctime', $date ) ); |
|
160 | - $search->setSlice( 0, 0 ); |
|
159 | + $search->setConditions($search->compare('>', 'order.base.ctime', $date)); |
|
160 | + $search->setSlice(0, 0); |
|
161 | 161 | $totalOrders = 0; |
162 | - $baseManager->searchItems( $search, [], $totalOrders ); |
|
162 | + $baseManager->searchItems($search, [], $totalOrders); |
|
163 | 163 | |
164 | - $baseProductManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base/product' ); |
|
164 | + $baseProductManager = \Aimeos\MShop\Factory::createManager($context, 'order/base/product'); |
|
165 | 165 | $search = $baseProductManager->createSearch(); |
166 | - $search->setConditions( $search->compare( '>', 'order.base.product.ctime', $date ) ); |
|
166 | + $search->setConditions($search->compare('>', 'order.base.product.ctime', $date)); |
|
167 | 167 | $start = 0; |
168 | 168 | |
169 | 169 | do |
170 | 170 | { |
171 | - $totalCounts = $baseProductManager->aggregate( $search, 'order.base.product.productid' ); |
|
172 | - $prodIds = array_keys( $totalCounts ); |
|
171 | + $totalCounts = $baseProductManager->aggregate($search, 'order.base.product.productid'); |
|
172 | + $prodIds = array_keys($totalCounts); |
|
173 | 173 | |
174 | - foreach( $totalCounts as $id => $count ) |
|
174 | + foreach ($totalCounts as $id => $count) |
|
175 | 175 | { |
176 | - $this->removeListItems( $id ); |
|
176 | + $this->removeListItems($id); |
|
177 | 177 | |
178 | - if( $count / $totalOrders > $minSupport ) |
|
178 | + if ($count / $totalOrders > $minSupport) |
|
179 | 179 | { |
180 | - $productIds = $this->getSuggestions( $id, $prodIds, $count, $totalOrders, $maxItems, $minSupport, $minConfidence, $date ); |
|
181 | - $this->addListItems( $id, $productIds ); |
|
180 | + $productIds = $this->getSuggestions($id, $prodIds, $count, $totalOrders, $maxItems, $minSupport, $minConfidence, $date); |
|
181 | + $this->addListItems($id, $productIds); |
|
182 | 182 | } |
183 | 183 | } |
184 | 184 | |
185 | - $count = count( $totalCounts ); |
|
185 | + $count = count($totalCounts); |
|
186 | 186 | $start += $count; |
187 | - $search->setSlice( $start ); |
|
187 | + $search->setSlice($start); |
|
188 | 188 | } |
189 | - while( $count >= $search->getSliceSize() ); |
|
189 | + while ($count >= $search->getSliceSize()); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | |
@@ -203,59 +203,59 @@ discard block |
||
203 | 203 | * @param string $date Date in YYYY-MM-DD HH:mm:ss format after which orders should be used for calculations |
204 | 204 | * @return array List of suggested product IDs as key and their confidence as value |
205 | 205 | */ |
206 | - protected function getSuggestions( $id, $prodIds, $count, $total, $maxItems, $minSupport, $minConfidence, $date ) |
|
206 | + protected function getSuggestions($id, $prodIds, $count, $total, $maxItems, $minSupport, $minConfidence, $date) |
|
207 | 207 | { |
208 | 208 | $refIds = []; |
209 | 209 | $context = $this->getContext(); |
210 | 210 | |
211 | - $catalogListManager = \Aimeos\MShop\Factory::createManager( $context, 'catalog/lists' ); |
|
212 | - $baseProductManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base/product' ); |
|
211 | + $catalogListManager = \Aimeos\MShop\Factory::createManager($context, 'catalog/lists'); |
|
212 | + $baseProductManager = \Aimeos\MShop\Factory::createManager($context, 'order/base/product'); |
|
213 | 213 | |
214 | 214 | |
215 | 215 | $search = $baseProductManager->createSearch(); |
216 | - $func = $search->createFunction( 'order.base.product.count', array( (string) $id ) ); |
|
216 | + $func = $search->createFunction('order.base.product.count', array((string) $id)); |
|
217 | 217 | $expr = array( |
218 | - $search->compare( '==', 'order.base.product.productid', $prodIds ), |
|
219 | - $search->compare( '>', 'order.base.product.ctime', $date ), |
|
220 | - $search->compare( '==', $func, 1 ), |
|
218 | + $search->compare('==', 'order.base.product.productid', $prodIds), |
|
219 | + $search->compare('>', 'order.base.product.ctime', $date), |
|
220 | + $search->compare('==', $func, 1), |
|
221 | 221 | ); |
222 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
222 | + $search->setConditions($search->combine('&&', $expr)); |
|
223 | 223 | |
224 | - $relativeCounts = $baseProductManager->aggregate( $search, 'order.base.product.productid' ); |
|
224 | + $relativeCounts = $baseProductManager->aggregate($search, 'order.base.product.productid'); |
|
225 | 225 | |
226 | 226 | |
227 | 227 | $search = $catalogListManager->createSearch(); |
228 | 228 | $expr = array( |
229 | - $search->compare( '==', 'catalog.lists.refid', array_keys( $relativeCounts ) ), |
|
230 | - $search->compare( '==', 'catalog.lists.domain', 'product' ), |
|
229 | + $search->compare('==', 'catalog.lists.refid', array_keys($relativeCounts)), |
|
230 | + $search->compare('==', 'catalog.lists.domain', 'product'), |
|
231 | 231 | ); |
232 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
232 | + $search->setConditions($search->combine('&&', $expr)); |
|
233 | 233 | |
234 | - foreach( $catalogListManager->searchItems( $search ) as $listItem ) { |
|
234 | + foreach ($catalogListManager->searchItems($search) as $listItem) { |
|
235 | 235 | $refIds[$listItem->getRefId()] = true; |
236 | 236 | } |
237 | 237 | |
238 | 238 | |
239 | - unset( $relativeCounts[$id] ); |
|
239 | + unset($relativeCounts[$id]); |
|
240 | 240 | $supportA = $count / $total; |
241 | 241 | $products = []; |
242 | 242 | |
243 | - foreach( $relativeCounts as $prodId => $relCnt ) |
|
243 | + foreach ($relativeCounts as $prodId => $relCnt) |
|
244 | 244 | { |
245 | - if( !isset( $refIds[$prodId] ) ) { |
|
245 | + if (!isset($refIds[$prodId])) { |
|
246 | 246 | continue; |
247 | 247 | } |
248 | 248 | |
249 | 249 | $supportAB = $relCnt / $total; |
250 | 250 | |
251 | - if( $supportAB > $minSupport && ( $conf = ( $supportAB / $supportA ) ) > $minConfidence ) { |
|
251 | + if ($supportAB > $minSupport && ($conf = ($supportAB / $supportA)) > $minConfidence) { |
|
252 | 252 | $products[$prodId] = $conf; |
253 | 253 | } |
254 | 254 | } |
255 | 255 | |
256 | - arsort( $products ); |
|
256 | + arsort($products); |
|
257 | 257 | |
258 | - return array_keys( array_slice( $products, 0, $maxItems, true ) ); |
|
258 | + return array_keys(array_slice($products, 0, $maxItems, true)); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | |
@@ -265,26 +265,26 @@ discard block |
||
265 | 265 | * @param string $productId Unique ID of the product the given products should be referenced to |
266 | 266 | * @param array $productIds List of position as key and product ID as value |
267 | 267 | */ |
268 | - protected function addListItems( $productId, array $productIds ) |
|
268 | + protected function addListItems($productId, array $productIds) |
|
269 | 269 | { |
270 | - if( empty( $productIds ) ) { |
|
270 | + if (empty($productIds)) { |
|
271 | 271 | return; |
272 | 272 | } |
273 | 273 | |
274 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/lists' ); |
|
274 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/lists'); |
|
275 | 275 | $item = $manager->createItem(); |
276 | 276 | |
277 | - foreach( $productIds as $pos => $refid ) |
|
277 | + foreach ($productIds as $pos => $refid) |
|
278 | 278 | { |
279 | - $item->setId( null ); |
|
280 | - $item->setParentId( $productId ); |
|
281 | - $item->setDomain( 'product' ); |
|
282 | - $item->setType( 'bought-together' ); |
|
283 | - $item->setPosition( $pos ); |
|
284 | - $item->setRefId( $refid ); |
|
285 | - $item->setStatus( 1 ); |
|
286 | - |
|
287 | - $manager->saveItem( $item, false ); |
|
279 | + $item->setId(null); |
|
280 | + $item->setParentId($productId); |
|
281 | + $item->setDomain('product'); |
|
282 | + $item->setType('bought-together'); |
|
283 | + $item->setPosition($pos); |
|
284 | + $item->setRefId($refid); |
|
285 | + $item->setStatus(1); |
|
286 | + |
|
287 | + $manager->saveItem($item, false); |
|
288 | 288 | } |
289 | 289 | } |
290 | 290 | |
@@ -294,20 +294,20 @@ discard block |
||
294 | 294 | * |
295 | 295 | * @param string $productId Unique ID of the product the references should be removed from |
296 | 296 | */ |
297 | - protected function removeListItems( $productId ) |
|
297 | + protected function removeListItems($productId) |
|
298 | 298 | { |
299 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/lists' ); |
|
299 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/lists'); |
|
300 | 300 | |
301 | 301 | $search = $manager->createSearch(); |
302 | 302 | $expr = array( |
303 | - $search->compare( '==', 'product.lists.parentid', $productId ), |
|
304 | - $search->compare( '==', 'product.lists.domain', 'product' ), |
|
305 | - $search->compare( '==', 'product.lists.type', 'bought-together' ), |
|
303 | + $search->compare('==', 'product.lists.parentid', $productId), |
|
304 | + $search->compare('==', 'product.lists.domain', 'product'), |
|
305 | + $search->compare('==', 'product.lists.type', 'bought-together'), |
|
306 | 306 | ); |
307 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
307 | + $search->setConditions($search->combine('&&', $expr)); |
|
308 | 308 | |
309 | - $listItems = $manager->searchItems( $search ); |
|
309 | + $listItems = $manager->searchItems($search); |
|
310 | 310 | |
311 | - $manager->deleteItems( array_keys( $listItems ) ); |
|
311 | + $manager->deleteItems(array_keys($listItems)); |
|
312 | 312 | } |
313 | 313 | } |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | * @param array $mapping Associative list of field position in CSV as key and domain item key as value |
44 | 44 | * @param \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $object Decorated processor |
45 | 45 | */ |
46 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
47 | - \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $object = null ) |
|
46 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
47 | + \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $object = null) |
|
48 | 48 | { |
49 | - parent::__construct( $context, $mapping, $object ); |
|
49 | + parent::__construct($context, $mapping, $object); |
|
50 | 50 | |
51 | 51 | /** controller/common/catalog/import/csv/processor/media/listtypes |
52 | 52 | * Names of the catalog list types for media that are updated or removed |
@@ -68,32 +68,32 @@ discard block |
||
68 | 68 | * @see controller/common/catalog/import/csv/processor/text/listtypes |
69 | 69 | */ |
70 | 70 | $key = 'controller/common/catalog/import/csv/processor/media/listtypes'; |
71 | - $this->listTypes = $context->getConfig()->get( $key ); |
|
71 | + $this->listTypes = $context->getConfig()->get($key); |
|
72 | 72 | |
73 | - if( $this->listTypes === null ) |
|
73 | + if ($this->listTypes === null) |
|
74 | 74 | { |
75 | 75 | $this->listTypes = []; |
76 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'catalog/lists/type' ); |
|
76 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'catalog/lists/type'); |
|
77 | 77 | |
78 | - $search = $manager->createSearch()->setSlice( 0, 0x7fffffff ); |
|
79 | - $search->setConditions( $search->compare( '==', 'catalog.lists.type.domain', 'media' ) ); |
|
78 | + $search = $manager->createSearch()->setSlice(0, 0x7fffffff); |
|
79 | + $search->setConditions($search->compare('==', 'catalog.lists.type.domain', 'media')); |
|
80 | 80 | |
81 | - foreach( $manager->searchItems( $search ) as $item ) { |
|
81 | + foreach ($manager->searchItems($search) as $item) { |
|
82 | 82 | $this->listTypes[$item->getCode()] = $item->getCode(); |
83 | 83 | } |
84 | 84 | } |
85 | 85 | else |
86 | 86 | { |
87 | - $this->listTypes = array_flip( $this->listTypes ); |
|
87 | + $this->listTypes = array_flip($this->listTypes); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | |
91 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'media/type' ); |
|
91 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'media/type'); |
|
92 | 92 | |
93 | - $search = $manager->createSearch()->setSlice( 0, 0x7fffffff ); |
|
94 | - $search->setConditions( $search->compare( '==', 'media.type.domain', 'catalog' ) ); |
|
93 | + $search = $manager->createSearch()->setSlice(0, 0x7fffffff); |
|
94 | + $search->setConditions($search->compare('==', 'media.type.domain', 'catalog')); |
|
95 | 95 | |
96 | - foreach( $manager->searchItems( $search ) as $item ) { |
|
96 | + foreach ($manager->searchItems($search) as $item) { |
|
97 | 97 | $this->types[$item->getCode()] = $item->getCode(); |
98 | 98 | } |
99 | 99 | } |
@@ -106,60 +106,60 @@ discard block |
||
106 | 106 | * @param array $data List of CSV fields with position as key and data as value |
107 | 107 | * @return array List of data which hasn't been imported |
108 | 108 | */ |
109 | - public function process( \Aimeos\MShop\Catalog\Item\Iface $catalog, array $data ) |
|
109 | + public function process(\Aimeos\MShop\Catalog\Item\Iface $catalog, array $data) |
|
110 | 110 | { |
111 | 111 | $context = $this->getContext(); |
112 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'media' ); |
|
113 | - $listManager = \Aimeos\MShop\Factory::createManager( $context, 'catalog/lists' ); |
|
114 | - $separator = $context->getConfig()->get( 'controller/common/catalog/import/csv/separator', "\n" ); |
|
112 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'media'); |
|
113 | + $listManager = \Aimeos\MShop\Factory::createManager($context, 'catalog/lists'); |
|
114 | + $separator = $context->getConfig()->get('controller/common/catalog/import/csv/separator', "\n"); |
|
115 | 115 | |
116 | 116 | $listMap = []; |
117 | - $map = $this->getMappedChunk( $data, $this->getMapping() ); |
|
118 | - $listItems = $catalog->getListItems( 'media', $this->listTypes ); |
|
117 | + $map = $this->getMappedChunk($data, $this->getMapping()); |
|
118 | + $listItems = $catalog->getListItems('media', $this->listTypes); |
|
119 | 119 | |
120 | - foreach( $listItems as $listItem ) |
|
120 | + foreach ($listItems as $listItem) |
|
121 | 121 | { |
122 | - if( ( $refItem = $listItem->getRefItem() ) !== null ) { |
|
123 | - $listMap[ $refItem->getUrl() ][ $refItem->getType() ][ $listItem->getType() ] = $listItem; |
|
122 | + if (($refItem = $listItem->getRefItem()) !== null) { |
|
123 | + $listMap[$refItem->getUrl()][$refItem->getType()][$listItem->getType()] = $listItem; |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
127 | - foreach( $map as $pos => $list ) |
|
127 | + foreach ($map as $pos => $list) |
|
128 | 128 | { |
129 | - if( $this->checkEntry( $list ) === false ) { |
|
129 | + if ($this->checkEntry($list) === false) { |
|
130 | 130 | continue; |
131 | 131 | } |
132 | 132 | |
133 | - $type = $this->getValue( $list, 'media.type', 'default' ); |
|
134 | - $listtype = $this->getValue( $list, 'catalog.lists.type', 'default' ); |
|
135 | - $urls = explode( $separator, $this->getValue( $list, 'media.url', '' ) ); |
|
133 | + $type = $this->getValue($list, 'media.type', 'default'); |
|
134 | + $listtype = $this->getValue($list, 'catalog.lists.type', 'default'); |
|
135 | + $urls = explode($separator, $this->getValue($list, 'media.url', '')); |
|
136 | 136 | |
137 | - foreach( $urls as $url ) |
|
137 | + foreach ($urls as $url) |
|
138 | 138 | { |
139 | - if( isset( $listMap[$url][$type][$listtype] ) ) |
|
139 | + if (isset($listMap[$url][$type][$listtype])) |
|
140 | 140 | { |
141 | 141 | $listItem = $listMap[$url][$type][$listtype]; |
142 | 142 | $refItem = $listItem->getRefItem(); |
143 | - unset( $listItems[ $listItem->getId() ] ); |
|
143 | + unset($listItems[$listItem->getId()]); |
|
144 | 144 | } |
145 | 145 | else |
146 | 146 | { |
147 | - $listItem = $listManager->createItem( $listtype, 'media' ); |
|
148 | - $refItem = $manager->createItem( $type, 'catalog' ); |
|
147 | + $listItem = $listManager->createItem($listtype, 'media'); |
|
148 | + $refItem = $manager->createItem($type, 'catalog'); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | $list['media.url'] = $url; |
152 | 152 | |
153 | - $list = $refItem->fromArray( $this->addItemDefaults( $list ) ); |
|
154 | - $list = $listItem->fromArray( $this->addListItemDefaults( $list, $pos++ ) ); |
|
153 | + $list = $refItem->fromArray($this->addItemDefaults($list)); |
|
154 | + $list = $listItem->fromArray($this->addListItemDefaults($list, $pos++)); |
|
155 | 155 | |
156 | - $catalog->addListItem( 'media', $listItem, $refItem ); |
|
156 | + $catalog->addListItem('media', $listItem, $refItem); |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | |
160 | - $catalog->deleteListItems( $listItems, true ); |
|
160 | + $catalog->deleteListItems($listItems, true); |
|
161 | 161 | |
162 | - return $this->getObject()->process( $catalog, $data ); |
|
162 | + return $this->getObject()->process($catalog, $data); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | |
@@ -169,17 +169,17 @@ discard block |
||
169 | 169 | * @param array $list Associative list of domain item keys and their values, e.g. "media.status" => 1 |
170 | 170 | * @return array Given associative list enriched by default values if they were not already set |
171 | 171 | */ |
172 | - protected function addItemDefaults( array $list ) |
|
172 | + protected function addItemDefaults(array $list) |
|
173 | 173 | { |
174 | - if( !isset( $list['media.label'] ) ) { |
|
174 | + if (!isset($list['media.label'])) { |
|
175 | 175 | $list['media.label'] = $list['media.url']; |
176 | 176 | } |
177 | 177 | |
178 | - if( !isset( $list['media.preview'] ) ) { |
|
178 | + if (!isset($list['media.preview'])) { |
|
179 | 179 | $list['media.preview'] = $list['media.url']; |
180 | 180 | } |
181 | 181 | |
182 | - if( !isset( $list['media.status'] ) ) { |
|
182 | + if (!isset($list['media.status'])) { |
|
183 | 183 | $list['media.status'] = 1; |
184 | 184 | } |
185 | 185 | |
@@ -193,22 +193,22 @@ discard block |
||
193 | 193 | * @param array $list Associative list of key/value pairs from the mapping |
194 | 194 | * @return boolean True if valid, false if not |
195 | 195 | */ |
196 | - protected function checkEntry( array $list ) |
|
196 | + protected function checkEntry(array $list) |
|
197 | 197 | { |
198 | - if( $this->getValue( $list, 'media.url' ) === null ) { |
|
198 | + if ($this->getValue($list, 'media.url') === null) { |
|
199 | 199 | return false; |
200 | 200 | } |
201 | 201 | |
202 | - if( ( $type = $this->getValue( $list, 'catalog.lists.type' ) ) && !isset( $this->listTypes[$type] ) ) |
|
202 | + if (($type = $this->getValue($list, 'catalog.lists.type')) && !isset($this->listTypes[$type])) |
|
203 | 203 | { |
204 | - $msg = sprintf( 'Invalid type "%1$s" (%2$s)', $type, 'catalog list' ); |
|
205 | - throw new \Aimeos\Controller\Common\Exception( $msg ); |
|
204 | + $msg = sprintf('Invalid type "%1$s" (%2$s)', $type, 'catalog list'); |
|
205 | + throw new \Aimeos\Controller\Common\Exception($msg); |
|
206 | 206 | } |
207 | 207 | |
208 | - if( ( $type = $this->getValue( $list, 'media.type' ) ) && !isset( $this->types[$type] ) ) |
|
208 | + if (($type = $this->getValue($list, 'media.type')) && !isset($this->types[$type])) |
|
209 | 209 | { |
210 | - $msg = sprintf( 'Invalid type "%1$s" (%2$s)', $type, 'media' ); |
|
211 | - throw new \Aimeos\Controller\Common\Exception( $msg ); |
|
210 | + $msg = sprintf('Invalid type "%1$s" (%2$s)', $type, 'media'); |
|
211 | + throw new \Aimeos\Controller\Common\Exception($msg); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | return true; |
@@ -81,8 +81,7 @@ discard block |
||
81 | 81 | foreach( $manager->searchItems( $search ) as $item ) { |
82 | 82 | $this->listTypes[$item->getCode()] = $item->getCode(); |
83 | 83 | } |
84 | - } |
|
85 | - else |
|
84 | + } else |
|
86 | 85 | { |
87 | 86 | $this->listTypes = array_flip( $this->listTypes ); |
88 | 87 | } |
@@ -141,8 +140,7 @@ discard block |
||
141 | 140 | $listItem = $listMap[$url][$type][$listtype]; |
142 | 141 | $refItem = $listItem->getRefItem(); |
143 | 142 | unset( $listItems[ $listItem->getId() ] ); |
144 | - } |
|
145 | - else |
|
143 | + } else |
|
146 | 144 | { |
147 | 145 | $listItem = $listManager->createItem( $listtype, 'media' ); |
148 | 146 | $refItem = $manager->createItem( $type, 'catalog' ); |