Skip to content

Commit c8cd484

Browse files
committed
Merge branch 'master' into 3.X
Signed-off-by: Toha <tohenk@yahoo.com>
2 parents baf857a + de3c2bc commit c8cd484

File tree

11 files changed

+129
-16
lines changed

11 files changed

+129
-16
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [ "3.X" ]
6+
pull_request:
7+
branches: [ "3.X" ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
test:
14+
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
matrix:
19+
php-version:
20+
- "7.2"
21+
- "7.3"
22+
- "7.4"
23+
- "8.0"
24+
- "8.1"
25+
26+
steps:
27+
- uses: actions/checkout@v3
28+
29+
- name: Install PHP
30+
uses: shivammathur/setup-php@v2
31+
with:
32+
php-version: ${{ matrix.php-version }}
33+
34+
- name: Validate composer.json and composer.lock
35+
run: composer validate --strict
36+
37+
- name: Cache Composer packages
38+
id: composer-cache
39+
uses: actions/cache@v3
40+
with:
41+
path: vendor
42+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
43+
restore-keys: |
44+
${{ runner.os }}-php-
45+
46+
- name: Install dependencies
47+
run: composer install --prefer-dist --no-progress
48+
49+
- name: Build model
50+
run: |
51+
vendor/bin/mysql-workbench-schema-export --config=export1.json vendor/mysql-workbench-schema-exporter/mysql-workbench-schema-exporter/example/data/sakila.mwb
52+
vendor/bin/mysql-workbench-schema-export --config=export2.json vendor/mysql-workbench-schema-exporter/mysql-workbench-schema-exporter/example/data/sakila.mwb

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
# README
22

3+
![Build Status](https://github.com/mysql-workbench-schema-exporter/zend1-exporter/actions/workflows/continuous-integration.yml/badge.svg)
4+
[![Latest Stable Version](https://poser.pugx.org/mysql-workbench-schema-exporter/zend1-exporter/v/stable.svg)](https://packagist.org/packages/mysql-workbench-schema-exporter/zend1-exporter)
5+
[![Total Downloads](https://poser.pugx.org/mysql-workbench-schema-exporter/zend1-exporter/downloads.svg)](https://packagist.org/packages/mysql-workbench-schema-exporter/zend1-exporter)
6+
[![License](https://poser.pugx.org/mysql-workbench-schema-exporter/zend1-exporter/license.svg)](https://packagist.org/packages/mysql-workbench-schema-exporter/zend1-exporter)
7+
38
This is an exporter to convert [MySQL Workbench](http://www.mysql.com/products/workbench/) Models (\*.mwb) to Zend Framework 1 DbTable and RestController Schema.
49

510
## Prerequisites
611

7-
* PHP 5.4+
12+
* PHP 7.2+
813
* Composer to install the dependencies
914

1015
## Installation

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
}
2727
],
2828
"require" : {
29-
"php" : ">=5.4.0",
30-
"mysql-workbench-schema-exporter/mysql-workbench-schema-exporter": "^3.1"
29+
"php" : ">=7.2",
30+
"mysql-workbench-schema-exporter/mysql-workbench-schema-exporter": "^3.2"
3131
},
3232
"autoload" : {
3333
"psr-4" : {

export1.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"export": "zend-dbtable",
3+
"zip": false,
4+
"dir": "build",
5+
"params": {
6+
"language": "english",
7+
"namingStrategy": "as-is",
8+
"logToConsole": false,
9+
"logFile": "",
10+
"backupExistingFile": true,
11+
"useTabs": false,
12+
"indentation": 4,
13+
"eolDelimeter": "win",
14+
"addGeneratorInfoAsComment": true,
15+
"filename": "DbTable\/%schema%\/%entity%.%extension%",
16+
"skipPluralNameChecking": false,
17+
"useLoggedStorage": false,
18+
"sortTablesAndViews": true,
19+
"exportOnlyTableCategorized": "",
20+
"enhanceManyToManyDetection": true,
21+
"skipManyToManyTables": true,
22+
"stripMultipleUnderscores": false,
23+
"asIsUserDatatypePrefix": "",
24+
"tablePrefix": "Application_Model_DbTable_",
25+
"parentTable": "Zend_Db_Table_Abstract",
26+
"generateDRI": false,
27+
"generateGetterSetter": false
28+
}
29+
}

export2.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"export": "zend-restcontroller",
3+
"zip": false,
4+
"dir": "build",
5+
"params": {
6+
"language": "english",
7+
"namingStrategy": "as-is",
8+
"logToConsole": false,
9+
"logFile": "",
10+
"backupExistingFile": true,
11+
"useTabs": false,
12+
"indentation": 4,
13+
"eolDelimeter": "win",
14+
"addGeneratorInfoAsComment": true,
15+
"filename": "%entity%.%extension%",
16+
"skipPluralNameChecking": false,
17+
"useLoggedStorage": false,
18+
"sortTablesAndViews": true,
19+
"exportOnlyTableCategorized": "",
20+
"enhanceManyToManyDetection": true,
21+
"skipManyToManyTables": true,
22+
"stripMultipleUnderscores": false,
23+
"asIsUserDatatypePrefix": "",
24+
"tablePrefix": "",
25+
"parentTable": "Zend_Rest_Controller"
26+
}
27+
}

lib/DatatypeConverter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class DatatypeConverter extends BaseDatatypeConverter
3333
{
3434
public function setup()
3535
{
36-
$this->register(array(
36+
$this->register([
3737
static::DATATYPE_TINYINT => 'tinyint',
3838
static::DATATYPE_SMALLINT => 'smallint',
3939
static::DATATYPE_MEDIUMINT => 'mediumint',
@@ -93,6 +93,6 @@ public function setup()
9393
static::USERDATATYPE_NUMERIC => 'decimal',
9494
static::USERDATATYPE_DEC => 'decimal',
9595
static::USERDATATYPE_CHARACTER => 'char',
96-
));
96+
]);
9797
}
9898
}

lib/DbTable/Formatter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Formatter extends BaseFormatter
3838
protected function init()
3939
{
4040
parent::init();
41-
$this->addConfigurations(array(
41+
$this->addConfigurations([
4242
static::CFG_INDENTATION => 4,
4343
static::CFG_FILENAME => 'DbTable/%schema%/%entity%.%extension%',
4444
static::CFG_TABLE_PREFIX => 'Application_Model_DbTable_',
@@ -50,7 +50,7 @@ protected function init()
5050
// http://framework.zend.com/manual/en/zend.db.table.relationships.html#zend.db.table.relationships.cascading
5151
static::CFG_GENERATE_DRI => false,
5252
static::CFG_GENERATE_GETTER_SETTER => false,
53-
));
53+
]);
5454
}
5555

5656
/**

lib/DbTable/Model/ForeignKey.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ class ForeignKey extends BaseForeignKey
3535
public function write(WriterInterface $writer)
3636
{
3737
$writer
38-
->write('\''. $this->getReferencedTable()->getRawTableName() .'\' => array(')
38+
->write('\''. $this->getReferencedTable()->getRawTableName() .'\' => [')
3939
->indent()
4040
->write('\'columns\' => \''. $this->getLocal()->getColumnName() .'\',')
4141
->write('\'refTableClass\' => \''. $this->getReferencedTable()->getRawTableName() .'\',')
4242
->write('\'refColumns\' => \''. $this->getForeign()->getColumnName() .'\',')
4343
->outdent()
44-
->write('),')
44+
->write('],')
4545
;
4646

4747
return $this;

lib/DbTable/Model/Table.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function writeDependencies(WriterInterface $writer)
107107
->write(' *')
108108
->write(' * @var array')
109109
->write(' */')
110-
->write('protected $_dependentTables = array();')
110+
->write('protected $_dependentTables = [];')
111111
->write('')
112112
;
113113

@@ -122,15 +122,15 @@ public function writeReferences(WriterInterface $writer)
122122
->write(' */')
123123
->writeCallback(function(WriterInterface $writer, Table $_this = null) {
124124
if (count($_this->getForeignKeys())) {
125-
$writer->write('protected $_referenceMap = array(');
125+
$writer->write('protected $_referenceMap = [');
126126
$writer->indent();
127127
foreach ($_this->getForeignKeys() as $foreignKey) {
128128
$foreignKey->write($writer);
129129
}
130130
$writer->outdent();
131-
$writer->write(');');
131+
$writer->write('];');
132132
} else {
133-
$writer->write('protected $_referenceMap = array();');
133+
$writer->write('protected $_referenceMap = [];');
134134
}
135135
})
136136
;

lib/Formatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ abstract class Formatter extends BaseFormatter
3636

3737
public function getVersion()
3838
{
39-
return '3.1.1';
39+
return '3.2.0';
4040
}
4141
}

lib/RestController/Formatter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ class Formatter extends BaseFormatter
3535
protected function init()
3636
{
3737
parent::init();
38-
$this->addConfigurations(array(
38+
$this->addConfigurations([
3939
static::CFG_INDENTATION => 4,
4040
static::CFG_FILENAME => '%entity%.%extension%',
4141
static::CFG_TABLE_PREFIX => '',
4242
static::CFG_PARENT_TABLE => 'Zend_Rest_Controller',
43-
));
43+
]);
4444
}
4545

4646
/**

0 commit comments

Comments
 (0)