@@ 66-88 (lines=23) @@ | ||
63 | * |
|
64 | * @return void |
|
65 | */ |
|
66 | public function generate(Schema $schema) |
|
67 | { |
|
68 | // First generate base |
|
69 | $this->generateBase($schema); |
|
70 | ||
71 | $outputDirectory = $schema->absoluteDirectory; |
|
72 | $this->createDirectory($outputDirectory); |
|
73 | ||
74 | foreach ($schema->getTables() as $table) { |
|
75 | $outputFile = $outputDirectory . DIRECTORY_SEPARATOR . $table->phpName . '.php'; |
|
76 | ||
77 | // Check if file already exists, do not override the file |
|
78 | if (is_file($outputFile)) { |
|
79 | continue; |
|
80 | } |
|
81 | ||
82 | $template = $this->twig->render('object.php.twig', [ |
|
83 | 'table' => $table |
|
84 | ]); |
|
85 | ||
86 | file_put_contents($outputFile, $template); |
|
87 | } |
|
88 | } |
|
89 | ||
90 | /** |
|
91 | * @param Schema $schema |
@@ 63-85 (lines=23) @@ | ||
60 | * |
|
61 | * @return void |
|
62 | */ |
|
63 | public function generate(Schema $schema) |
|
64 | { |
|
65 | // First generate base |
|
66 | $this->generateBase($schema); |
|
67 | ||
68 | $outputDirectory = $schema->absoluteDirectory; |
|
69 | $this->createDirectory($outputDirectory); |
|
70 | ||
71 | foreach ($schema->getTables() as $table) { |
|
72 | $outputFile = $outputDirectory . DIRECTORY_SEPARATOR . $table->phpName . 'Query.php'; |
|
73 | ||
74 | // Check if file already exists, do not override the file |
|
75 | if (is_file($outputFile)) { |
|
76 | continue; |
|
77 | } |
|
78 | ||
79 | $template = $this->twig->render('query.php.twig', [ |
|
80 | 'table' => $table |
|
81 | ]); |
|
82 | ||
83 | file_put_contents($outputFile, $template); |
|
84 | } |
|
85 | } |
|
86 | ||
87 | /** |
|
88 | * @param Schema $schema |