@@ -46,21 +46,18 @@ |
||
| 46 | 46 | { |
| 47 | 47 | $options[$name] = (array) $options[$name]; |
| 48 | 48 | $options[$name][] = substr( $option, $pos + 1 ); |
| 49 | - } |
|
| 50 | - else |
|
| 49 | + } else |
|
| 51 | 50 | { |
| 52 | 51 | $options[$name] = substr( $option, $pos + 1 ); |
| 53 | 52 | } |
| 54 | 53 | |
| 55 | 54 | unset( $params[$key] ); |
| 56 | - } |
|
| 57 | - else |
|
| 55 | + } else |
|
| 58 | 56 | { |
| 59 | 57 | printf( "Invalid option \"%1\$s\"\n", $option ); |
| 60 | 58 | usage(); |
| 61 | 59 | } |
| 62 | - } |
|
| 63 | - elseif( $option[0] === '-' ) |
|
| 60 | + } elseif( $option[0] === '-' ) |
|
| 64 | 61 | { |
| 65 | 62 | $options[$option[1]] = substr( $option, 1 ); |
| 66 | 63 | unset( $params[$key] ); |
@@ -173,9 +173,13 @@ |
||
| 173 | 173 | |
| 174 | 174 | foreach( $testdata[$domain] as $entry ) |
| 175 | 175 | { |
| 176 | - try { |
|
| 176 | + try |
|
| 177 | + { |
|
| 177 | 178 | $manager->save( $manager->create()->fromArray( $entry ), false ); |
| 178 | - } catch( \Exception $e ) {} // Duplicate entry |
|
| 179 | + } |
|
| 180 | + catch( \Exception $e ) |
|
| 181 | + { |
|
| 182 | +} // Duplicate entry |
|
| 179 | 183 | } |
| 180 | 184 | } |
| 181 | 185 | } |
@@ -138,9 +138,12 @@ |
||
| 138 | 138 | { |
| 139 | 139 | foreach( $data['customer/group'] as $entry ) |
| 140 | 140 | { |
| 141 | - try { |
|
| 141 | + try |
|
| 142 | + { |
|
| 142 | 143 | $groupManager->save( $groupManager->find( $entry['customer.group.code'] )->fromArray( $entry ) ); |
| 143 | - } catch( \Exception $e ) { |
|
| 144 | + } |
|
| 145 | + catch( \Exception $e ) |
|
| 146 | + { |
|
| 144 | 147 | $groupManager->save( $groupManager->create()->fromArray( $entry ), false ); |
| 145 | 148 | } |
| 146 | 149 | } |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | $item = $item->setId( null )->fromArray( $dataset ); |
| 51 | 51 | $manager->save( $item ); |
| 52 | 52 | } |
| 53 | - catch( \Exception $e ) { ; } // if attribute was already available |
|
| 53 | + catch( \Exception $e ) {; } // if attribute was already available |
|
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | } |
@@ -50,7 +50,9 @@ |
||
| 50 | 50 | $item = $item->setId( null )->fromArray( $dataset ); |
| 51 | 51 | $manager->save( $item ); |
| 52 | 52 | } |
| 53 | - catch( \Exception $e ) { ; } // if attribute was already available |
|
| 53 | + catch( \Exception $e ) |
|
| 54 | + { |
|
| 55 | +; } // if attribute was already available |
|
| 54 | 56 | } |
| 55 | 57 | } |
| 56 | 58 | } |
@@ -89,8 +89,7 @@ |
||
| 89 | 89 | |
| 90 | 90 | $attrManager->save( $item ); |
| 91 | 91 | $id = $item->getId(); |
| 92 | - } |
|
| 93 | - else |
|
| 92 | + } else |
|
| 94 | 93 | { |
| 95 | 94 | $id = $attrItem->getId(); |
| 96 | 95 | } |
@@ -79,8 +79,7 @@ discard block |
||
| 79 | 79 | for( $i = 0; $i < $numCatPerLevel; $i++ ) { |
| 80 | 80 | $treeFcn( $parents, $catItem->getId(), $numCatPerLevel, $level - 1, $catLabel . '-' . ( $i + 1 ), $i ); |
| 81 | 81 | } |
| 82 | - } |
|
| 83 | - else |
|
| 82 | + } else |
|
| 84 | 83 | { |
| 85 | 84 | $fcn = function( array $parents, $catLabel ) { |
| 86 | 85 | |
@@ -139,9 +138,12 @@ discard block |
||
| 139 | 138 | |
| 140 | 139 | while( true ) |
| 141 | 140 | { |
| 142 | - try { |
|
| 141 | + try |
|
| 142 | + { |
|
| 143 | 143 | return $catalogManager->insert( $item, $parentId ); |
| 144 | - } catch( \Aimeos\MW\DB\Exception $e ) { |
|
| 144 | + } |
|
| 145 | + catch( \Aimeos\MW\DB\Exception $e ) |
|
| 146 | + { |
|
| 145 | 147 | if( $e->getCode() !== 40001 ) { throw $e; } // transaction deadlock |
| 146 | 148 | } |
| 147 | 149 | } |
@@ -169,7 +169,7 @@ |
||
| 169 | 169 | |
| 170 | 170 | try { |
| 171 | 171 | $localeManager->save( $item ); |
| 172 | - } catch( \Aimeos\MW\DB\Exception $e ) { ; } // if locale combination was already available |
|
| 172 | + } catch( \Aimeos\MW\DB\Exception $e ) {; } // if locale combination was already available |
|
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | 175 | } |
@@ -52,9 +52,12 @@ discard block |
||
| 52 | 52 | $localeManager = \Aimeos\MShop\Locale\Manager\Factory::create( $this->context(), 'Standard' ); |
| 53 | 53 | $siteManager = $localeManager->getSubManager( 'site' ); |
| 54 | 54 | |
| 55 | - try { |
|
| 55 | + try |
|
| 56 | + { |
|
| 56 | 57 | $siteItem = $siteManager->insert( $siteManager->create()->setLabel( $code )->setCode( $code ) ); |
| 57 | - } catch( \Aimeos\MW\DB\Exception $e ) { |
|
| 58 | + } |
|
| 59 | + catch( \Aimeos\MW\DB\Exception $e ) |
|
| 60 | + { |
|
| 58 | 61 | $siteItem = $siteManager->find( $code ); |
| 59 | 62 | } |
| 60 | 63 | |
@@ -69,7 +72,9 @@ discard block |
||
| 69 | 72 | |
| 70 | 73 | $localeManager->save( $localeItem, false ); |
| 71 | 74 | } |
| 72 | - catch( \Aimeos\MW\DB\Exception $e ) {} // already in the database |
|
| 75 | + catch( \Aimeos\MW\DB\Exception $e ) |
|
| 76 | + { |
|
| 77 | +} // already in the database |
|
| 73 | 78 | } |
| 74 | 79 | |
| 75 | 80 | |
@@ -91,9 +96,12 @@ discard block |
||
| 91 | 96 | |
| 92 | 97 | foreach( $data as $key => $dataset ) |
| 93 | 98 | { |
| 94 | - try { |
|
| 99 | + try |
|
| 100 | + { |
|
| 95 | 101 | $item = $manager->insert( $manager->create()->fromArray( $dataset ), $parentId ); |
| 96 | - } catch( \Aimeos\MW\DB\Exception $e ) { |
|
| 102 | + } |
|
| 103 | + catch( \Aimeos\MW\DB\Exception $e ) |
|
| 104 | + { |
|
| 97 | 105 | $item = $manager->find( $key ); |
| 98 | 106 | } |
| 99 | 107 | |
@@ -162,9 +170,13 @@ discard block |
||
| 162 | 170 | ->set( 'site_id', $siteIds[$dataset['site']]['id'] ) |
| 163 | 171 | ->setSiteId( $siteIds[$dataset['site']]['site'] ); |
| 164 | 172 | |
| 165 | - try { |
|
| 173 | + try |
|
| 174 | + { |
|
| 166 | 175 | $localeManager->save( $item ); |
| 167 | - } catch( \Aimeos\MW\DB\Exception $e ) { ; } // if locale combination was already available |
|
| 176 | + } |
|
| 177 | + catch( \Aimeos\MW\DB\Exception $e ) |
|
| 178 | + { |
|
| 179 | +; } // if locale combination was already available |
|
| 168 | 180 | } |
| 169 | 181 | } |
| 170 | 182 | } |
@@ -165,7 +165,7 @@ |
||
| 165 | 165 | $manager = \Aimeos\MShop::create( $context, 'attribute' ); |
| 166 | 166 | $refItem = $manager->find( $refItem->getCode(), [], $domain, $refItem->getType() ); |
| 167 | 167 | } |
| 168 | - catch( \Exception $e ) { ; } // attribute doesn't exist yet |
|
| 168 | + catch( \Exception $e ) {; } // attribute doesn't exist yet |
|
| 169 | 169 | |
| 170 | 170 | $refItem = $this->addRefItems( $refItem, $data ); |
| 171 | 171 | $item->addListItem( 'attribute', $listItem, $refItem ); |
@@ -165,7 +165,9 @@ |
||
| 165 | 165 | $manager = \Aimeos\MShop::create( $context, 'attribute' ); |
| 166 | 166 | $refItem = $manager->find( $refItem->getCode(), [], $domain, $refItem->getType() ); |
| 167 | 167 | } |
| 168 | - catch( \Exception $e ) { ; } // attribute doesn't exist yet |
|
| 168 | + catch( \Exception $e ) |
|
| 169 | + { |
|
| 170 | +; } // attribute doesn't exist yet |
|
| 169 | 171 | |
| 170 | 172 | $refItem = $this->addRefItems( $refItem, $data ); |
| 171 | 173 | $item->addListItem( 'attribute', $listItem, $refItem ); |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | $this->removeItems( $item->getId(), 'catalog/lists', 'catalog', 'text' ); |
| 64 | 64 | $this->removeListItems( $item->getId(), 'catalog/lists', 'product' ); |
| 65 | 65 | } |
| 66 | - catch( \Exception $e ) { ; } // If no root node was already inserted into the database |
|
| 66 | + catch( \Exception $e ) {; } // If no root node was already inserted into the database |
|
| 67 | 67 | |
| 68 | 68 | $search = $manager->filter(); |
| 69 | 69 | $search->setConditions( $search->compare( '=~', 'catalog.code', 'demo-' ) ); |
@@ -63,7 +63,9 @@ |
||
| 63 | 63 | $this->removeItems( $item->getId(), 'catalog/lists', 'catalog', 'text' ); |
| 64 | 64 | $this->removeListItems( $item->getId(), 'catalog/lists', 'product' ); |
| 65 | 65 | } |
| 66 | - catch( \Exception $e ) { ; } // If no root node was already inserted into the database |
|
| 66 | + catch( \Exception $e ) |
|
| 67 | + { |
|
| 68 | +; } // If no root node was already inserted into the database |
|
| 67 | 69 | |
| 68 | 70 | $search = $manager->filter(); |
| 69 | 71 | $search->setConditions( $search->compare( '=~', 'catalog.code', 'demo-' ) ); |