| @@ 93-112 (lines=20) @@ | ||
| 90 | /** |
|
| 91 | * @param Schema $schema |
|
| 92 | */ |
|
| 93 | protected function generateBase(Schema $schema) |
|
| 94 | { |
|
| 95 | $outputDirectory = $schema->absoluteDirectory . DIRECTORY_SEPARATOR . 'Base'; |
|
| 96 | $this->createDirectory($outputDirectory); |
|
| 97 | ||
| 98 | // Allow overriding template for a given driver |
|
| 99 | $driver = Rocket::getConnectionDriver($schema->connection); |
|
| 100 | ||
| 101 | foreach ($schema->getTables() as $table) { |
|
| 102 | $template = $this->twig->resolveTemplate([ |
|
| 103 | '@' . $driver . '/base_object.php.twig', |
|
| 104 | 'base_object.php.twig' |
|
| 105 | ])->render([ |
|
| 106 | 'table' => $table, |
|
| 107 | 'driver' => $driver |
|
| 108 | ]); |
|
| 109 | ||
| 110 | file_put_contents($outputDirectory . DIRECTORY_SEPARATOR . 'Base' . $table->phpName . '.php', $template); |
|
| 111 | } |
|
| 112 | } |
|
| 113 | } |
|
| 114 | ||
| @@ 90-109 (lines=20) @@ | ||
| 87 | /** |
|
| 88 | * @param Schema $schema |
|
| 89 | */ |
|
| 90 | protected function generateBase(Schema $schema) |
|
| 91 | { |
|
| 92 | $outputDirectory = $schema->absoluteDirectory . DIRECTORY_SEPARATOR . 'Base'; |
|
| 93 | $this->createDirectory($outputDirectory); |
|
| 94 | ||
| 95 | // Allow overriding template for a given driver |
|
| 96 | $driver = Rocket::getConnectionDriver($schema->connection); |
|
| 97 | ||
| 98 | foreach ($schema->getTables() as $table) { |
|
| 99 | $template = $this->twig->resolveTemplate([ |
|
| 100 | '@' . $driver . '/base_query.php.twig', |
|
| 101 | 'base_query.php.twig' |
|
| 102 | ])->render([ |
|
| 103 | 'table' => $table, |
|
| 104 | 'driver' => $driver |
|
| 105 | ]); |
|
| 106 | ||
| 107 | file_put_contents($outputDirectory . DIRECTORY_SEPARATOR . 'Base' . $table->phpName . 'Query.php', $template); |
|
| 108 | } |
|
| 109 | } |
|
| 110 | } |
|
| 111 | ||