|
@@ -35,7 +35,11 @@ class LuGenerator {
|
35
|
35
|
"namespace" => 'App\Http\Business',
|
36
|
36
|
"folder" => '../app/Http/Business'
|
37
|
37
|
),
|
38
|
|
- "mode" => 0775
|
|
38
|
+ "mode" => 0775,
|
|
39
|
+ "ignore" => array(
|
|
40
|
+ "tables" => array(),
|
|
41
|
+ "sp" => array()
|
|
42
|
+ )
|
39
|
43
|
);
|
40
|
44
|
/**
|
41
|
45
|
* @return array
|
|
@@ -52,11 +56,11 @@ class LuGenerator {
|
52
|
56
|
$this->_config = $config;
|
53
|
57
|
}
|
54
|
58
|
|
55
|
|
- public function __construct($db_connection, $db_database, $db_host, $db_port, $db_username, $db_password)
|
|
59
|
+ public function __construct()
|
56
|
60
|
{
|
57
|
|
- $dsn = $db_connection . ":dbname=" . $db_database . ";host="
|
58
|
|
- . $db_host . ";port=" . $db_port;
|
59
|
|
- $this->_pdo = new PDO($dsn, $db_username, $db_password);
|
|
61
|
+ $dsn = getenv("DB_CONNECTION") . ":dbname=" . getenv("DB_DATABASE") . ";host="
|
|
62
|
+ . getenv("DB_HOST") . ";port=" . getenv("DB_PORT");
|
|
63
|
+ $this->_pdo = new PDO($dsn, getenv("DB_USERNAME"), getenv("DB_PASSWORD"));
|
60
|
64
|
}
|
61
|
65
|
|
62
|
66
|
protected function printError($query, $message)
|
|
@@ -269,6 +273,16 @@ ORDER BY parameters.ordinal_position;");
|
269
|
273
|
mkdir($dir, $dir_mode, true);
|
270
|
274
|
}
|
271
|
275
|
|
|
276
|
+ public function matchIgnore($ignore, $name)
|
|
277
|
+ {
|
|
278
|
+ foreach ($this->_config["ignore"][$ignore] as $reg)
|
|
279
|
+ {
|
|
280
|
+ if (preg_match($reg, $name))
|
|
281
|
+ return true;
|
|
282
|
+ }
|
|
283
|
+ return false;
|
|
284
|
+ }
|
|
285
|
+
|
272
|
286
|
public function run()
|
273
|
287
|
{
|
274
|
288
|
$dbo_dir = $this->_config["dbo"]["folder"] . "/";
|
|
@@ -290,6 +304,10 @@ ORDER BY parameters.ordinal_position;");
|
290
|
304
|
if (!is_null($tables)) {
|
291
|
305
|
foreach ($tables as $table) {
|
292
|
306
|
$table_name = $table["table_name"];
|
|
307
|
+ if ($this->matchIgnore("tables", $table_name)) {
|
|
308
|
+ echo "Table $table_name ignored\n";
|
|
309
|
+ continue;
|
|
310
|
+ }
|
293
|
311
|
$columns = $this->getColumns($table_name);
|
294
|
312
|
if (is_null($columns))
|
295
|
313
|
continue;
|
|
@@ -315,6 +333,10 @@ ORDER BY parameters.ordinal_position;");
|
315
|
333
|
foreach ($sps as $sp)
|
316
|
334
|
{
|
317
|
335
|
$sp_name = $sp["sp_name"];
|
|
336
|
+ if ($this->matchIgnore("sp", $sp_name)) {
|
|
337
|
+ echo "Stored procedure $sp_name ignored\n";
|
|
338
|
+ continue;
|
|
339
|
+ }
|
318
|
340
|
$args = $this->getStoredProceduresArguments($sp);
|
319
|
341
|
if (is_null($args))
|
320
|
342
|
continue;
|