-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconvertSQL.php
More file actions
executable file
·40 lines (32 loc) · 1.02 KB
/
convertSQL.php
File metadata and controls
executable file
·40 lines (32 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/php
<?php
require __DIR__ . '/vendor/autoload.php';
use CGCLabs\sql2Entity\sql2Entity;
if (in_array('-h', $argv) || in_array('--help', $argv)) {
?>
This is a command line PHP script that will create doctrine entity file(s) based on SQL.
Usage:
<?php echo $argv[0]; ?> <sql file> <output folder (optional)> <options>
<options> can be -v for verbose mode. With the --help or -h options, you will get this help.
<?php
} else {
$verboseMode = 0;
$ormMode = 0;
$output = 'generatedEntities/';
if (isset($argv[1])) {
$file = $argv[1];
if (isset($argv[2]) && $argv[2] != '-v' && $argv[2] != 'o') {
$output = $argv[2];
}
if (in_array('-v', $argv)) {
$verboseMode = 1;
}
if (in_array('-o', $argv)) {
$ormMode = 1;
}
$converter = new sql2Entity($file, $verboseMode, $output, $ormMode);
$converter->generateEntity();
} else {
echo "\nNo SQL file specified\n";
}
}