@@ -17,7 +17,7 @@ |
||
| 17 | 17 | /** |
| 18 | 18 | * Returns the list of task names which depends on this task. |
| 19 | 19 | * |
| 20 | - * @return array List of task names |
|
| 20 | + * @return string[] List of task names |
|
| 21 | 21 | */ |
| 22 | 22 | public function getPreDependencies() |
| 23 | 23 | { |
@@ -14,121 +14,121 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | class EzuserAddAddress extends \Aimeos\MW\Setup\Task\TablesCreateMShop |
| 16 | 16 | { |
| 17 | - /** |
|
| 18 | - * Returns the list of task names which depends on this task. |
|
| 19 | - * |
|
| 20 | - * @return array List of task names |
|
| 21 | - */ |
|
| 22 | - public function getPreDependencies() |
|
| 23 | - { |
|
| 24 | - return array( 'TablesCreateEzpublish' ); |
|
| 25 | - } |
|
| 26 | - |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * Migrate database schema |
|
| 30 | - */ |
|
| 31 | - public function migrate() |
|
| 32 | - { |
|
| 33 | - $this->msg( 'Adding address fields to ezuser table', 0 ); |
|
| 34 | - |
|
| 35 | - $dbal = $this->getConnection( 'db-customer' )->getRawObject(); |
|
| 36 | - |
|
| 37 | - if( !( $dbal instanceof \Doctrine\DBAL\Connection ) ) { |
|
| 38 | - throw new \Aimeos\MW\Setup\Exception( 'Not a DBAL connection' ); |
|
| 39 | - } |
|
| 40 | - |
|
| 41 | - |
|
| 42 | - $fromSchema = $dbal->getSchemaManager()->createSchema(); |
|
| 43 | - $comparator = new \Doctrine\DBAL\Schema\Comparator(); |
|
| 44 | - $toSchema = clone $fromSchema; |
|
| 45 | - |
|
| 46 | - $this->addIndexes( $this->addColumns( $toSchema->getTable( 'ezuser' ) ) ); |
|
| 47 | - $sql = $fromSchema->getMigrateToSql( $toSchema, $dbal->getDatabasePlatform() ); |
|
| 48 | - |
|
| 49 | - if( $sql !== array() ) |
|
| 50 | - { |
|
| 51 | - $this->executeList( $sql, 'db-customer' ); |
|
| 52 | - $this->status( 'done' ); |
|
| 53 | - } |
|
| 54 | - else |
|
| 55 | - { |
|
| 56 | - $this->status( 'OK' ); |
|
| 57 | - } |
|
| 58 | - } |
|
| 59 | - |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * Adds the missing columns to the table |
|
| 63 | - * |
|
| 64 | - * @param \Doctrine\DBAL\Schema\Table $table Table object |
|
| 65 | - * @return \Doctrine\DBAL\Schema\Table Updated table object |
|
| 66 | - */ |
|
| 67 | - protected function addColumns( \Doctrine\DBAL\Schema\Table $table ) |
|
| 68 | - { |
|
| 69 | - $columns = array( |
|
| 70 | - 'company' => array( 'string', array( 'length' => 100 ) ), |
|
| 71 | - 'vatid' => array( 'string', array( 'length' => 32 ) ), |
|
| 72 | - 'salutation' => array( 'string', array( 'length' => 8 ) ), |
|
| 73 | - 'title' => array( 'string', array( 'length' => 64 ) ), |
|
| 74 | - 'firstname' => array( 'string', array( 'length' => 64 ) ), |
|
| 75 | - 'lastname' => array( 'string', array( 'length' => 64 ) ), |
|
| 76 | - 'address1' => array( 'string', array( 'length' => 255 ) ), |
|
| 77 | - 'address2' => array( 'string', array( 'length' => 255 ) ), |
|
| 78 | - 'address3' => array( 'string', array( 'length' => 255 ) ), |
|
| 79 | - 'postal' => array( 'string', array( 'length' => 16 ) ), |
|
| 80 | - 'city' => array( 'string', array( 'length' => 255 ) ), |
|
| 81 | - 'state' => array( 'string', array( 'length' => 255 ) ), |
|
| 82 | - 'langid' => array( 'string', array( 'length' => 5, 'notnull' => false ) ), |
|
| 83 | - 'countryid' => array( 'string', array( 'length' => 2, 'notnull' => false, 'fixed' => true ) ), |
|
| 84 | - 'telephone' => array( 'string', array( 'length' => 32 ) ), |
|
| 85 | - 'telefax' => array( 'string', array( 'length' => 32 ) ), |
|
| 86 | - 'website' => array( 'string', array( 'length' => 255 ) ), |
|
| 87 | - 'birthday' => array( 'date', array( 'notnull' => false ) ), |
|
| 88 | - 'vdate' => array( 'date', array( 'notnull' => false ) ), |
|
| 89 | - 'status' => array( 'smallint', array() ), |
|
| 90 | - 'mtime' => array( 'datetime', array() ), |
|
| 91 | - 'ctime' => array( 'datetime', array() ), |
|
| 92 | - 'editor' => array( 'string', array( 'length' => 255 ) ), |
|
| 93 | - ); |
|
| 94 | - |
|
| 95 | - foreach( $columns as $name => $def ) |
|
| 96 | - { |
|
| 97 | - if( $table->hasColumn( $name ) === false ) { |
|
| 98 | - $table->addColumn( $name, $def[0], $def[1] ); |
|
| 99 | - } |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - return $table; |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * Adds the missing indexes to the table |
|
| 108 | - * |
|
| 109 | - * @param \Doctrine\DBAL\Schema\Table $table Table object |
|
| 110 | - * @return \Doctrine\DBAL\Schema\Table Updated table object |
|
| 111 | - */ |
|
| 112 | - protected function addIndexes( \Doctrine\DBAL\Schema\Table $table ) |
|
| 113 | - { |
|
| 114 | - $indexes = array( |
|
| 115 | - 'idx_ezpus_langid' => array( 'langid' ), |
|
| 116 | - 'idx_ezpus_status_ln_fn' => array( 'status', 'lastname', 'firstname' ), |
|
| 117 | - 'idx_ezpus_status_ad1_ad2' => array( 'status', 'address1', 'address2' ), |
|
| 118 | - 'idx_ezpus_status_postal_city' => array( 'status', 'postal', 'city' ), |
|
| 119 | - 'idx_ezpus_lastname' => array( 'lastname' ), |
|
| 120 | - 'idx_ezpus_address1' => array( 'address1' ), |
|
| 121 | - 'idx_ezpus_postal' => array( 'postal' ), |
|
| 122 | - 'idx_ezpus_city' => array( 'city' ), |
|
| 123 | - ); |
|
| 124 | - |
|
| 125 | - foreach( $indexes as $name => $def ) |
|
| 126 | - { |
|
| 127 | - if( $table->hasIndex( $name ) === false ) { |
|
| 128 | - $table->addIndex( $def, $name ); |
|
| 129 | - } |
|
| 130 | - } |
|
| 131 | - |
|
| 132 | - return $table; |
|
| 133 | - } |
|
| 17 | + /** |
|
| 18 | + * Returns the list of task names which depends on this task. |
|
| 19 | + * |
|
| 20 | + * @return array List of task names |
|
| 21 | + */ |
|
| 22 | + public function getPreDependencies() |
|
| 23 | + { |
|
| 24 | + return array( 'TablesCreateEzpublish' ); |
|
| 25 | + } |
|
| 26 | + |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * Migrate database schema |
|
| 30 | + */ |
|
| 31 | + public function migrate() |
|
| 32 | + { |
|
| 33 | + $this->msg( 'Adding address fields to ezuser table', 0 ); |
|
| 34 | + |
|
| 35 | + $dbal = $this->getConnection( 'db-customer' )->getRawObject(); |
|
| 36 | + |
|
| 37 | + if( !( $dbal instanceof \Doctrine\DBAL\Connection ) ) { |
|
| 38 | + throw new \Aimeos\MW\Setup\Exception( 'Not a DBAL connection' ); |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + |
|
| 42 | + $fromSchema = $dbal->getSchemaManager()->createSchema(); |
|
| 43 | + $comparator = new \Doctrine\DBAL\Schema\Comparator(); |
|
| 44 | + $toSchema = clone $fromSchema; |
|
| 45 | + |
|
| 46 | + $this->addIndexes( $this->addColumns( $toSchema->getTable( 'ezuser' ) ) ); |
|
| 47 | + $sql = $fromSchema->getMigrateToSql( $toSchema, $dbal->getDatabasePlatform() ); |
|
| 48 | + |
|
| 49 | + if( $sql !== array() ) |
|
| 50 | + { |
|
| 51 | + $this->executeList( $sql, 'db-customer' ); |
|
| 52 | + $this->status( 'done' ); |
|
| 53 | + } |
|
| 54 | + else |
|
| 55 | + { |
|
| 56 | + $this->status( 'OK' ); |
|
| 57 | + } |
|
| 58 | + } |
|
| 59 | + |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * Adds the missing columns to the table |
|
| 63 | + * |
|
| 64 | + * @param \Doctrine\DBAL\Schema\Table $table Table object |
|
| 65 | + * @return \Doctrine\DBAL\Schema\Table Updated table object |
|
| 66 | + */ |
|
| 67 | + protected function addColumns( \Doctrine\DBAL\Schema\Table $table ) |
|
| 68 | + { |
|
| 69 | + $columns = array( |
|
| 70 | + 'company' => array( 'string', array( 'length' => 100 ) ), |
|
| 71 | + 'vatid' => array( 'string', array( 'length' => 32 ) ), |
|
| 72 | + 'salutation' => array( 'string', array( 'length' => 8 ) ), |
|
| 73 | + 'title' => array( 'string', array( 'length' => 64 ) ), |
|
| 74 | + 'firstname' => array( 'string', array( 'length' => 64 ) ), |
|
| 75 | + 'lastname' => array( 'string', array( 'length' => 64 ) ), |
|
| 76 | + 'address1' => array( 'string', array( 'length' => 255 ) ), |
|
| 77 | + 'address2' => array( 'string', array( 'length' => 255 ) ), |
|
| 78 | + 'address3' => array( 'string', array( 'length' => 255 ) ), |
|
| 79 | + 'postal' => array( 'string', array( 'length' => 16 ) ), |
|
| 80 | + 'city' => array( 'string', array( 'length' => 255 ) ), |
|
| 81 | + 'state' => array( 'string', array( 'length' => 255 ) ), |
|
| 82 | + 'langid' => array( 'string', array( 'length' => 5, 'notnull' => false ) ), |
|
| 83 | + 'countryid' => array( 'string', array( 'length' => 2, 'notnull' => false, 'fixed' => true ) ), |
|
| 84 | + 'telephone' => array( 'string', array( 'length' => 32 ) ), |
|
| 85 | + 'telefax' => array( 'string', array( 'length' => 32 ) ), |
|
| 86 | + 'website' => array( 'string', array( 'length' => 255 ) ), |
|
| 87 | + 'birthday' => array( 'date', array( 'notnull' => false ) ), |
|
| 88 | + 'vdate' => array( 'date', array( 'notnull' => false ) ), |
|
| 89 | + 'status' => array( 'smallint', array() ), |
|
| 90 | + 'mtime' => array( 'datetime', array() ), |
|
| 91 | + 'ctime' => array( 'datetime', array() ), |
|
| 92 | + 'editor' => array( 'string', array( 'length' => 255 ) ), |
|
| 93 | + ); |
|
| 94 | + |
|
| 95 | + foreach( $columns as $name => $def ) |
|
| 96 | + { |
|
| 97 | + if( $table->hasColumn( $name ) === false ) { |
|
| 98 | + $table->addColumn( $name, $def[0], $def[1] ); |
|
| 99 | + } |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + return $table; |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * Adds the missing indexes to the table |
|
| 108 | + * |
|
| 109 | + * @param \Doctrine\DBAL\Schema\Table $table Table object |
|
| 110 | + * @return \Doctrine\DBAL\Schema\Table Updated table object |
|
| 111 | + */ |
|
| 112 | + protected function addIndexes( \Doctrine\DBAL\Schema\Table $table ) |
|
| 113 | + { |
|
| 114 | + $indexes = array( |
|
| 115 | + 'idx_ezpus_langid' => array( 'langid' ), |
|
| 116 | + 'idx_ezpus_status_ln_fn' => array( 'status', 'lastname', 'firstname' ), |
|
| 117 | + 'idx_ezpus_status_ad1_ad2' => array( 'status', 'address1', 'address2' ), |
|
| 118 | + 'idx_ezpus_status_postal_city' => array( 'status', 'postal', 'city' ), |
|
| 119 | + 'idx_ezpus_lastname' => array( 'lastname' ), |
|
| 120 | + 'idx_ezpus_address1' => array( 'address1' ), |
|
| 121 | + 'idx_ezpus_postal' => array( 'postal' ), |
|
| 122 | + 'idx_ezpus_city' => array( 'city' ), |
|
| 123 | + ); |
|
| 124 | + |
|
| 125 | + foreach( $indexes as $name => $def ) |
|
| 126 | + { |
|
| 127 | + if( $table->hasIndex( $name ) === false ) { |
|
| 128 | + $table->addIndex( $def, $name ); |
|
| 129 | + } |
|
| 130 | + } |
|
| 131 | + |
|
| 132 | + return $table; |
|
| 133 | + } |
|
| 134 | 134 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | public function getPreDependencies() |
| 23 | 23 | { |
| 24 | - return array( 'TablesCreateEzpublish' ); |
|
| 24 | + return array('TablesCreateEzpublish'); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | |
@@ -30,12 +30,12 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function migrate() |
| 32 | 32 | { |
| 33 | - $this->msg( 'Adding address fields to ezuser table', 0 ); |
|
| 33 | + $this->msg('Adding address fields to ezuser table', 0); |
|
| 34 | 34 | |
| 35 | - $dbal = $this->getConnection( 'db-customer' )->getRawObject(); |
|
| 35 | + $dbal = $this->getConnection('db-customer')->getRawObject(); |
|
| 36 | 36 | |
| 37 | - if( !( $dbal instanceof \Doctrine\DBAL\Connection ) ) { |
|
| 38 | - throw new \Aimeos\MW\Setup\Exception( 'Not a DBAL connection' ); |
|
| 37 | + if (!($dbal instanceof \Doctrine\DBAL\Connection)) { |
|
| 38 | + throw new \Aimeos\MW\Setup\Exception('Not a DBAL connection'); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | |
@@ -43,17 +43,17 @@ discard block |
||
| 43 | 43 | $comparator = new \Doctrine\DBAL\Schema\Comparator(); |
| 44 | 44 | $toSchema = clone $fromSchema; |
| 45 | 45 | |
| 46 | - $this->addIndexes( $this->addColumns( $toSchema->getTable( 'ezuser' ) ) ); |
|
| 47 | - $sql = $fromSchema->getMigrateToSql( $toSchema, $dbal->getDatabasePlatform() ); |
|
| 46 | + $this->addIndexes($this->addColumns($toSchema->getTable('ezuser'))); |
|
| 47 | + $sql = $fromSchema->getMigrateToSql($toSchema, $dbal->getDatabasePlatform()); |
|
| 48 | 48 | |
| 49 | - if( $sql !== array() ) |
|
| 49 | + if ($sql !== array()) |
|
| 50 | 50 | { |
| 51 | - $this->executeList( $sql, 'db-customer' ); |
|
| 52 | - $this->status( 'done' ); |
|
| 51 | + $this->executeList($sql, 'db-customer'); |
|
| 52 | + $this->status('done'); |
|
| 53 | 53 | } |
| 54 | 54 | else |
| 55 | 55 | { |
| 56 | - $this->status( 'OK' ); |
|
| 56 | + $this->status('OK'); |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | |
@@ -64,38 +64,38 @@ discard block |
||
| 64 | 64 | * @param \Doctrine\DBAL\Schema\Table $table Table object |
| 65 | 65 | * @return \Doctrine\DBAL\Schema\Table Updated table object |
| 66 | 66 | */ |
| 67 | - protected function addColumns( \Doctrine\DBAL\Schema\Table $table ) |
|
| 67 | + protected function addColumns(\Doctrine\DBAL\Schema\Table $table) |
|
| 68 | 68 | { |
| 69 | 69 | $columns = array( |
| 70 | - 'company' => array( 'string', array( 'length' => 100 ) ), |
|
| 71 | - 'vatid' => array( 'string', array( 'length' => 32 ) ), |
|
| 72 | - 'salutation' => array( 'string', array( 'length' => 8 ) ), |
|
| 73 | - 'title' => array( 'string', array( 'length' => 64 ) ), |
|
| 74 | - 'firstname' => array( 'string', array( 'length' => 64 ) ), |
|
| 75 | - 'lastname' => array( 'string', array( 'length' => 64 ) ), |
|
| 76 | - 'address1' => array( 'string', array( 'length' => 255 ) ), |
|
| 77 | - 'address2' => array( 'string', array( 'length' => 255 ) ), |
|
| 78 | - 'address3' => array( 'string', array( 'length' => 255 ) ), |
|
| 79 | - 'postal' => array( 'string', array( 'length' => 16 ) ), |
|
| 80 | - 'city' => array( 'string', array( 'length' => 255 ) ), |
|
| 81 | - 'state' => array( 'string', array( 'length' => 255 ) ), |
|
| 82 | - 'langid' => array( 'string', array( 'length' => 5, 'notnull' => false ) ), |
|
| 83 | - 'countryid' => array( 'string', array( 'length' => 2, 'notnull' => false, 'fixed' => true ) ), |
|
| 84 | - 'telephone' => array( 'string', array( 'length' => 32 ) ), |
|
| 85 | - 'telefax' => array( 'string', array( 'length' => 32 ) ), |
|
| 86 | - 'website' => array( 'string', array( 'length' => 255 ) ), |
|
| 87 | - 'birthday' => array( 'date', array( 'notnull' => false ) ), |
|
| 88 | - 'vdate' => array( 'date', array( 'notnull' => false ) ), |
|
| 89 | - 'status' => array( 'smallint', array() ), |
|
| 90 | - 'mtime' => array( 'datetime', array() ), |
|
| 91 | - 'ctime' => array( 'datetime', array() ), |
|
| 92 | - 'editor' => array( 'string', array( 'length' => 255 ) ), |
|
| 70 | + 'company' => array('string', array('length' => 100)), |
|
| 71 | + 'vatid' => array('string', array('length' => 32)), |
|
| 72 | + 'salutation' => array('string', array('length' => 8)), |
|
| 73 | + 'title' => array('string', array('length' => 64)), |
|
| 74 | + 'firstname' => array('string', array('length' => 64)), |
|
| 75 | + 'lastname' => array('string', array('length' => 64)), |
|
| 76 | + 'address1' => array('string', array('length' => 255)), |
|
| 77 | + 'address2' => array('string', array('length' => 255)), |
|
| 78 | + 'address3' => array('string', array('length' => 255)), |
|
| 79 | + 'postal' => array('string', array('length' => 16)), |
|
| 80 | + 'city' => array('string', array('length' => 255)), |
|
| 81 | + 'state' => array('string', array('length' => 255)), |
|
| 82 | + 'langid' => array('string', array('length' => 5, 'notnull' => false)), |
|
| 83 | + 'countryid' => array('string', array('length' => 2, 'notnull' => false, 'fixed' => true)), |
|
| 84 | + 'telephone' => array('string', array('length' => 32)), |
|
| 85 | + 'telefax' => array('string', array('length' => 32)), |
|
| 86 | + 'website' => array('string', array('length' => 255)), |
|
| 87 | + 'birthday' => array('date', array('notnull' => false)), |
|
| 88 | + 'vdate' => array('date', array('notnull' => false)), |
|
| 89 | + 'status' => array('smallint', array()), |
|
| 90 | + 'mtime' => array('datetime', array()), |
|
| 91 | + 'ctime' => array('datetime', array()), |
|
| 92 | + 'editor' => array('string', array('length' => 255)), |
|
| 93 | 93 | ); |
| 94 | 94 | |
| 95 | - foreach( $columns as $name => $def ) |
|
| 95 | + foreach ($columns as $name => $def) |
|
| 96 | 96 | { |
| 97 | - if( $table->hasColumn( $name ) === false ) { |
|
| 98 | - $table->addColumn( $name, $def[0], $def[1] ); |
|
| 97 | + if ($table->hasColumn($name) === false) { |
|
| 98 | + $table->addColumn($name, $def[0], $def[1]); |
|
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | |
@@ -109,23 +109,23 @@ discard block |
||
| 109 | 109 | * @param \Doctrine\DBAL\Schema\Table $table Table object |
| 110 | 110 | * @return \Doctrine\DBAL\Schema\Table Updated table object |
| 111 | 111 | */ |
| 112 | - protected function addIndexes( \Doctrine\DBAL\Schema\Table $table ) |
|
| 112 | + protected function addIndexes(\Doctrine\DBAL\Schema\Table $table) |
|
| 113 | 113 | { |
| 114 | 114 | $indexes = array( |
| 115 | - 'idx_ezpus_langid' => array( 'langid' ), |
|
| 116 | - 'idx_ezpus_status_ln_fn' => array( 'status', 'lastname', 'firstname' ), |
|
| 117 | - 'idx_ezpus_status_ad1_ad2' => array( 'status', 'address1', 'address2' ), |
|
| 118 | - 'idx_ezpus_status_postal_city' => array( 'status', 'postal', 'city' ), |
|
| 119 | - 'idx_ezpus_lastname' => array( 'lastname' ), |
|
| 120 | - 'idx_ezpus_address1' => array( 'address1' ), |
|
| 121 | - 'idx_ezpus_postal' => array( 'postal' ), |
|
| 122 | - 'idx_ezpus_city' => array( 'city' ), |
|
| 115 | + 'idx_ezpus_langid' => array('langid'), |
|
| 116 | + 'idx_ezpus_status_ln_fn' => array('status', 'lastname', 'firstname'), |
|
| 117 | + 'idx_ezpus_status_ad1_ad2' => array('status', 'address1', 'address2'), |
|
| 118 | + 'idx_ezpus_status_postal_city' => array('status', 'postal', 'city'), |
|
| 119 | + 'idx_ezpus_lastname' => array('lastname'), |
|
| 120 | + 'idx_ezpus_address1' => array('address1'), |
|
| 121 | + 'idx_ezpus_postal' => array('postal'), |
|
| 122 | + 'idx_ezpus_city' => array('city'), |
|
| 123 | 123 | ); |
| 124 | 124 | |
| 125 | - foreach( $indexes as $name => $def ) |
|
| 125 | + foreach ($indexes as $name => $def) |
|
| 126 | 126 | { |
| 127 | - if( $table->hasIndex( $name ) === false ) { |
|
| 128 | - $table->addIndex( $def, $name ); |
|
| 127 | + if ($table->hasIndex($name) === false) { |
|
| 128 | + $table->addIndex($def, $name); |
|
| 129 | 129 | } |
| 130 | 130 | } |
| 131 | 131 | |