|
@@ -35,10 +35,16 @@ class LuGenerator {
|
35
|
35
|
"namespace" => 'App\Http\Business',
|
36
|
36
|
"folder" => '../app/Http/Business'
|
37
|
37
|
),
|
|
38
|
+ "controller" =>
|
|
39
|
+ array(
|
|
40
|
+ "namespace" => 'App\Http\Controller',
|
|
41
|
+ "folder" => '../app/Http/Controller'
|
|
42
|
+ ),
|
38
|
43
|
"mode" => 0775,
|
39
|
44
|
"ignore" => array(
|
40
|
45
|
"tables" => array(),
|
41
|
|
- "sp" => array()
|
|
46
|
+ "sp" => array(),
|
|
47
|
+ "controllers" => array()
|
42
|
48
|
)
|
43
|
49
|
);
|
44
|
50
|
/**
|
|
@@ -96,6 +102,7 @@ class LuGenerator {
|
96
|
102
|
$vars["sp_namespace"] = $this->_config["sp"]["namespace"];
|
97
|
103
|
$vars["dataaccess_namespace"] = $this->_config["dataaccess"]["namespace"];
|
98
|
104
|
$vars["business_namespace"] = $this->_config["business"]["namespace"];
|
|
105
|
+ $vars["controller_namespace"] = $this->_config["controller"]["namespace"];
|
99
|
106
|
|
100
|
107
|
$twig_vars = $this->buildTwigVars($vars);
|
101
|
108
|
|
|
@@ -269,6 +276,18 @@ ORDER BY parameters.ordinal_position;");
|
269
|
276
|
$this->buildTwig('business.php', $file, $vars);
|
270
|
277
|
}
|
271
|
278
|
|
|
279
|
+ public function generateController($controllerName, $businessName, $dboName, $file)
|
|
280
|
+ {
|
|
281
|
+ if (file_exists($file))
|
|
282
|
+ return;
|
|
283
|
+ $vars = array(
|
|
284
|
+ "controller_name" => $controllerName,
|
|
285
|
+ "business_name" => $businessName,
|
|
286
|
+ "dbo_name" => $dboName
|
|
287
|
+ );
|
|
288
|
+ $this->buildTwig('controller.php', $file, $vars);
|
|
289
|
+ }
|
|
290
|
+
|
272
|
291
|
public function mkdir($dir, $dir_mode)
|
273
|
292
|
{
|
274
|
293
|
if (!file_exists($dir))
|
|
@@ -292,6 +311,7 @@ ORDER BY parameters.ordinal_position;");
|
292
|
311
|
$sp_dir = $this->_config["sp"]["folder"] . "/";
|
293
|
312
|
$manager_dir = $this->_config["dataaccess"]["folder"] . "/";
|
294
|
313
|
$business_dir = $this->_config["business"]["folder"] . "/";
|
|
314
|
+ $controller_dir = $this->_config["controller"]["folder"] . "/";
|
295
|
315
|
|
296
|
316
|
$mode = $this->_config["mode"];
|
297
|
317
|
|
|
@@ -301,6 +321,7 @@ ORDER BY parameters.ordinal_position;");
|
301
|
321
|
$this->mkdir($sp_dir, $mode);
|
302
|
322
|
$this->mkdir($manager_dir, $mode);
|
303
|
323
|
$this->mkdir($business_dir, $mode);
|
|
324
|
+ $this->mkdir($controller_dir, $mode);
|
304
|
325
|
|
305
|
326
|
$tables = $this->getTables();
|
306
|
327
|
if (!is_null($tables)) {
|
|
@@ -320,6 +341,7 @@ ORDER BY parameters.ordinal_position;");
|
320
|
341
|
$dboName = $baseName . "Dbo";
|
321
|
342
|
$dataAccessName = $baseName . "DataAccess";
|
322
|
343
|
$businessName = $baseName . "Business";
|
|
344
|
+ $controllerName = $baseName . "Controller";
|
323
|
345
|
$this->generateDbo($dboName, $columns, $dbo_dir . $dboName . ".php");
|
324
|
346
|
$this->generateModel($modelName, $modelUserName, $dboName, $columns, $model_dir . $modelName . ".php",
|
325
|
347
|
$model_dir . $modelUserName . ".php");
|
|
@@ -327,6 +349,12 @@ ORDER BY parameters.ordinal_position;");
|
327
|
349
|
$manager_dir . $dataAccessName . ".php");
|
328
|
350
|
$this->generateBusiness($businessName, $dataAccessName, $dboName,
|
329
|
351
|
$business_dir . $businessName . ".php");
|
|
352
|
+ if ($this->matchIgnore("controllers", $controllerName)) {
|
|
353
|
+ echo "Controller $controllerName ignored\n";
|
|
354
|
+ continue;
|
|
355
|
+ }
|
|
356
|
+ $this->generateController($controllerName, $businessName, $dboName,
|
|
357
|
+ $controller_dir . $controllerName . ".php");
|
330
|
358
|
}
|
331
|
359
|
}
|
332
|
360
|
$sps = $this->getStoredProcedures();
|