@@ -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 | /** |