@@ -95,8 +95,7 @@ discard block |
||
95 | 95 | $files[] = $entry->getPathname(); |
96 | 96 | } |
97 | 97 | } |
98 | - } |
|
99 | - else |
|
98 | + } else |
|
100 | 99 | { |
101 | 100 | $files[] = $location; |
102 | 101 | } |
@@ -235,7 +234,9 @@ discard block |
||
235 | 234 | |
236 | 235 | return $currentid; |
237 | 236 | } |
238 | - catch( \Aimeos\MShop\Exception $e ) {} // not found, create new |
|
237 | + catch( \Aimeos\MShop\Exception $e ) |
|
238 | + { |
|
239 | +} // not found, create new |
|
239 | 240 | } |
240 | 241 | |
241 | 242 | $item = $this->process( $manager->createItem(), $node ); |
@@ -273,13 +274,11 @@ discard block |
||
273 | 274 | |
274 | 275 | $currentid = $this->importNode( $node, $domains, $parentid, $childMap ); |
275 | 276 | $total++; |
276 | - } |
|
277 | - elseif( $xml->nodeType === \XMLReader::ELEMENT && $xml->name === 'catalog' ) |
|
277 | + } elseif( $xml->nodeType === \XMLReader::ELEMENT && $xml->name === 'catalog' ) |
|
278 | 278 | { |
279 | 279 | $this->importTree( $xml, $domains, $currentid, $childMap ); |
280 | 280 | $childMap = []; |
281 | - } |
|
282 | - elseif( $xml->nodeType === \XMLReader::END_ELEMENT && $xml->name === 'catalog' ) |
|
281 | + } elseif( $xml->nodeType === \XMLReader::END_ELEMENT && $xml->name === 'catalog' ) |
|
283 | 282 | { |
284 | 283 | \Aimeos\MShop::create( $this->getContext(), 'catalog' )->deleteItems( $map ); |
285 | 284 | break; |
@@ -83,7 +83,7 @@ |
||
83 | 83 | { |
84 | 84 | $classname = '\\Aimeos\\Controller\\Common\\Common\\Import\\Xml\\Processor\\' . $segment; |
85 | 85 | |
86 | - if( class_exists( $classname ) === false ){ |
|
86 | + if( class_exists( $classname ) === false ) { |
|
87 | 87 | throw new \Aimeos\Controller\Common\Exception( sprintf( 'Class "%1$s" not found', $classname ) ); |
88 | 88 | } |
89 | 89 | } |
@@ -86,8 +86,7 @@ |
||
86 | 86 | $listItem = $map[$parentid][$type]; |
87 | 87 | unset( $listItems[$map[$parentid][$type]->getId()] ); |
88 | 88 | unset( $map[$parentid][$type] ); |
89 | - } |
|
90 | - else |
|
89 | + } else |
|
91 | 90 | { |
92 | 91 | $listItem = $listManager->createItem(); |
93 | 92 | } |
@@ -87,8 +87,7 @@ |
||
87 | 87 | foreach( $manager->searchItems( $search ) as $item ) { |
88 | 88 | $this->listTypes[$item->getCode()] = $item->getCode(); |
89 | 89 | } |
90 | - } |
|
91 | - else |
|
90 | + } else |
|
92 | 91 | { |
93 | 92 | $this->listTypes = array_flip( $this->listTypes ); |
94 | 93 | } |
@@ -575,9 +575,11 @@ |
||
575 | 575 | |
576 | 576 | $map = $this->getMappedChunk( $list, $mapping ); |
577 | 577 | |
578 | - if( isset( $map[0] ) ) // there can only be one chunk for the base product data |
|
578 | + if( isset( $map[0] ) ) { |
|
579 | + // there can only be one chunk for the base product data |
|
579 | 580 | { |
580 | 581 | $type = $this->checkType( $this->getValue( $map[0], 'product.type', $product->getType() ) ); |
582 | + } |
|
581 | 583 | |
582 | 584 | $product = $product->fromArray( $map[0], true ); |
583 | 585 | $product = $manager->saveItem( $product->setType( $type ) ); |
@@ -154,8 +154,7 @@ |
||
154 | 154 | $interval = new \DateInterval( $item->getInterval() ); |
155 | 155 | $date = date_create( $item->getTimeCreated() )->add( $interval )->format( 'Y-m-d' ); |
156 | 156 | $item = $item->setDateNext( $date )->setPeriod( 1 ); |
157 | - } |
|
158 | - elseif( $item->getTimeCreated() < $date ) |
|
157 | + } elseif( $item->getTimeCreated() < $date ) |
|
159 | 158 | { |
160 | 159 | $item->setStatus( 0 ); |
161 | 160 | } |
@@ -45,19 +45,19 @@ discard block |
||
45 | 45 | /** |
46 | 46 | * Stores all types for which no type items exist yet |
47 | 47 | */ |
48 | - public function __destruct() |
|
49 | - { |
|
50 | - foreach( $this->types as $path => $list ) |
|
51 | - { |
|
48 | + public function __destruct() |
|
49 | + { |
|
50 | + foreach( $this->types as $path => $list ) |
|
51 | + { |
|
52 | 52 | $manager = \Aimeos\MShop::create( $this->context, $path ); |
53 | 53 | $prefix = str_replace( '/', '.', $path ); |
54 | 54 | |
55 | 55 | foreach( $list as $domain => $codes ) |
56 | - { |
|
57 | - $manager->begin(); |
|
56 | + { |
|
57 | + $manager->begin(); |
|
58 | 58 | |
59 | - try |
|
60 | - { |
|
59 | + try |
|
60 | + { |
|
61 | 61 | $search = $manager->createSearch()->setSlice( 0, 10000 ); |
62 | 62 | $expr = [ |
63 | 63 | $search->compare( '==', $prefix . '.domain', $domain ), |
@@ -76,29 +76,29 @@ discard block |
||
76 | 76 | } |
77 | 77 | |
78 | 78 | $manager->saveItems( $items, false ); |
79 | - $manager->commit(); |
|
80 | - } |
|
81 | - catch( \Exception $e ) |
|
82 | - { |
|
83 | - $manager->rollback(); |
|
84 | - $this->context->getLogger()->log( 'Error saving types: ' . $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
85 | - } |
|
86 | - } |
|
87 | - } |
|
88 | - } |
|
89 | - |
|
90 | - |
|
91 | - /** |
|
92 | - * Registers a used type which is going to be saved if it doesn't exist yet |
|
93 | - * |
|
94 | - * @param string $path Manager path, e.g. "product/lists/type" |
|
95 | - * @param string $domain Domain name the type belongs to, e.g. "attribute" |
|
96 | - * @param string $code Type code |
|
97 | - */ |
|
98 | - protected function addType( string $path, string $domain, string $code ) |
|
99 | - { |
|
100 | - $this->types[$path][$domain][$code] = $code; |
|
101 | - } |
|
79 | + $manager->commit(); |
|
80 | + } |
|
81 | + catch( \Exception $e ) |
|
82 | + { |
|
83 | + $manager->rollback(); |
|
84 | + $this->context->getLogger()->log( 'Error saving types: ' . $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
85 | + } |
|
86 | + } |
|
87 | + } |
|
88 | + } |
|
89 | + |
|
90 | + |
|
91 | + /** |
|
92 | + * Registers a used type which is going to be saved if it doesn't exist yet |
|
93 | + * |
|
94 | + * @param string $path Manager path, e.g. "product/lists/type" |
|
95 | + * @param string $domain Domain name the type belongs to, e.g. "attribute" |
|
96 | + * @param string $code Type code |
|
97 | + */ |
|
98 | + protected function addType( string $path, string $domain, string $code ) |
|
99 | + { |
|
100 | + $this->types[$path][$domain][$code] = $code; |
|
101 | + } |
|
102 | 102 | |
103 | 103 | |
104 | 104 | /** |
@@ -37,19 +37,19 @@ discard block |
||
37 | 37 | /** |
38 | 38 | * Stores all types for which no type items exist yet |
39 | 39 | */ |
40 | - public function __destruct() |
|
41 | - { |
|
42 | - foreach( $this->types as $path => $list ) |
|
43 | - { |
|
40 | + public function __destruct() |
|
41 | + { |
|
42 | + foreach( $this->types as $path => $list ) |
|
43 | + { |
|
44 | 44 | $manager = \Aimeos\MShop::create( $this->context, $path ); |
45 | 45 | $prefix = str_replace( '/', '.', $path ); |
46 | 46 | |
47 | 47 | foreach( $list as $domain => $codes ) |
48 | - { |
|
49 | - $manager->begin(); |
|
48 | + { |
|
49 | + $manager->begin(); |
|
50 | 50 | |
51 | - try |
|
52 | - { |
|
51 | + try |
|
52 | + { |
|
53 | 53 | $search = $manager->createSearch()->setSlice( 0, 10000 ); |
54 | 54 | $expr = [ |
55 | 55 | $search->compare( '==', $prefix . '.domain', $domain ), |
@@ -68,29 +68,29 @@ discard block |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | $manager->saveItems( $items, false ); |
71 | - $manager->commit(); |
|
72 | - } |
|
73 | - catch( \Exception $e ) |
|
74 | - { |
|
75 | - $manager->rollback(); |
|
76 | - $this->context->getLogger()->log( 'Error saving types: ' . $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
77 | - } |
|
78 | - } |
|
79 | - } |
|
80 | - } |
|
81 | - |
|
82 | - |
|
83 | - /** |
|
84 | - * Registers a used type which is going to be saved if it doesn't exist yet |
|
85 | - * |
|
86 | - * @param string $path Manager path, e.g. "product/lists/type" |
|
87 | - * @param string $domain Domain name the type belongs to, e.g. "attribute" |
|
88 | - * @param string $code Type code |
|
89 | - */ |
|
90 | - protected function addType( string $path, string $domain, string $code ) |
|
91 | - { |
|
92 | - $this->types[$path][$domain][$code] = $code; |
|
93 | - } |
|
71 | + $manager->commit(); |
|
72 | + } |
|
73 | + catch( \Exception $e ) |
|
74 | + { |
|
75 | + $manager->rollback(); |
|
76 | + $this->context->getLogger()->log( 'Error saving types: ' . $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
77 | + } |
|
78 | + } |
|
79 | + } |
|
80 | + } |
|
81 | + |
|
82 | + |
|
83 | + /** |
|
84 | + * Registers a used type which is going to be saved if it doesn't exist yet |
|
85 | + * |
|
86 | + * @param string $path Manager path, e.g. "product/lists/type" |
|
87 | + * @param string $domain Domain name the type belongs to, e.g. "attribute" |
|
88 | + * @param string $code Type code |
|
89 | + */ |
|
90 | + protected function addType( string $path, string $domain, string $code ) |
|
91 | + { |
|
92 | + $this->types[$path][$domain][$code] = $code; |
|
93 | + } |
|
94 | 94 | |
95 | 95 | |
96 | 96 | /** |