@@ -78,7 +78,7 @@ |
||
78 | 78 | $connection = Rocket::getConnection($connectionName); |
79 | 79 | foreach ($databases as $databaseName) { |
80 | 80 | if (!$connection->createDatabase($databaseName)) { |
81 | - throw new \RuntimeException('Cannot create the database "' . $databaseName . '"'); |
|
81 | + throw new \RuntimeException('Cannot create the database "'.$databaseName.'"'); |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | protected function execute(InputInterface $input, OutputInterface $output) |
45 | 45 | { |
46 | 46 | $schemas = $this->getSchemas($this->getSchemaPath()); |
47 | - $output->write('Generating ' . sizeof($schemas) . ' SQL schemas files... '); |
|
47 | + $output->write('Generating '.sizeof($schemas).' SQL schemas files... '); |
|
48 | 48 | $this->verbose($output, ''); |
49 | 49 | |
50 | 50 | try { |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | $output->writeln('<info>Success</info>'); |
72 | - $output->writeln('Generated files are located in <options=underscore>"' . $this->getSqlOutputPath() . '"</options=underscore>'); |
|
72 | + $output->writeln('Generated files are located in <options=underscore>"'.$this->getSqlOutputPath().'"</options=underscore>'); |
|
73 | 73 | |
74 | 74 | return 0; |
75 | 75 | } |
@@ -68,7 +68,7 @@ |
||
68 | 68 | |
69 | 69 | /** @var Schema $schema */ |
70 | 70 | foreach ($schemas as $schema) { |
71 | - $this->verbose($output, 'Inserting tables for database "' . $schema->database . '"... ', false); |
|
71 | + $this->verbose($output, 'Inserting tables for database "'.$schema->database.'"... ', false); |
|
72 | 72 | try { |
73 | 73 | $tableGenerator->generate($schema); |
74 | 74 | } catch (\Exception $e) { |
@@ -43,15 +43,15 @@ |
||
43 | 43 | public function generate(Schema $schema) |
44 | 44 | { |
45 | 45 | if (!is_dir($this->inputPath)) { |
46 | - throw new \RuntimeException('The input file path "' . $this->inputPath . '" is not a directory'); |
|
46 | + throw new \RuntimeException('The input file path "'.$this->inputPath.'" is not a directory'); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | $con = Rocket::getConnection($schema->connection); |
50 | 50 | if (!$con instanceof SQLitePDO) { |
51 | - $con->exec('use ' . $schema->database); |
|
51 | + $con->exec('use '.$schema->database); |
|
52 | 52 | } |
53 | 53 | |
54 | - $file = file_get_contents($this->inputPath . DIRECTORY_SEPARATOR . $schema->database . '.sql'); |
|
54 | + $file = file_get_contents($this->inputPath.DIRECTORY_SEPARATOR.$schema->database.'.sql'); |
|
55 | 55 | $file = preg_replace('/(-- ?(.)*)*/', '', $file); // delete comments |
56 | 56 | |
57 | 57 | $queries = explode(';', $file); |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | $this->outputPath = $outputPath; |
41 | 41 | |
42 | 42 | $loader = new \Twig_Loader_Filesystem(array_merge($templateDirs, [ |
43 | - __DIR__ . '/../Resources/Skeletons/Database' |
|
43 | + __DIR__.'/../Resources/Skeletons/Database' |
|
44 | 44 | ])); |
45 | - $loader->addPath(__DIR__ . '/../Resources/Skeletons/Database/Driver/SQLite', 'sqlite'); |
|
45 | + $loader->addPath(__DIR__.'/../Resources/Skeletons/Database/Driver/SQLite', 'sqlite'); |
|
46 | 46 | |
47 | 47 | $this->twig = new \Twig_Environment($loader, [ |
48 | 48 | 'cache' => false, |
@@ -63,11 +63,11 @@ discard block |
||
63 | 63 | // Allow overriding template for a given driver |
64 | 64 | $driver = Rocket::getConnectionDriver($schema->connection); |
65 | 65 | |
66 | - $template = $this->twig->resolveTemplate(['@' . $driver . '/schema.sql.twig', 'schema.sql.twig'])->render([ |
|
66 | + $template = $this->twig->resolveTemplate(['@'.$driver.'/schema.sql.twig', 'schema.sql.twig'])->render([ |
|
67 | 67 | 'schema' => $schema, |
68 | 68 | 'driver' => $driver |
69 | 69 | ]); |
70 | 70 | |
71 | - file_put_contents($this->outputPath . DIRECTORY_SEPARATOR . $schema->database . '.sql', $template); |
|
71 | + file_put_contents($this->outputPath.DIRECTORY_SEPARATOR.$schema->database.'.sql', $template); |
|
72 | 72 | } |
73 | 73 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | $this->modelNamespace = $modelNamespace; |
45 | - $this->twig = new \Twig_Environment(new \Twig_Loader_Filesystem(array_merge($templateDirs, [__DIR__ . '/../../Resources/Skeletons/Model/Map'])), [ |
|
45 | + $this->twig = new \Twig_Environment(new \Twig_Loader_Filesystem(array_merge($templateDirs, [__DIR__.'/../../Resources/Skeletons/Model/Map'])), [ |
|
46 | 46 | 'cache' => false, |
47 | 47 | 'strict_variables' => true |
48 | 48 | ]); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function generate(Schema $schema) |
55 | 55 | { |
56 | - $outputDirectory = $schema->absoluteDirectory . DIRECTORY_SEPARATOR . 'TableMap'; |
|
56 | + $outputDirectory = $schema->absoluteDirectory.DIRECTORY_SEPARATOR.'TableMap'; |
|
57 | 57 | $this->createDirectory($outputDirectory); |
58 | 58 | |
59 | 59 | foreach ($schema->getTables() as $table) { |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | 'table' => $table |
62 | 62 | ]); |
63 | 63 | |
64 | - file_put_contents($outputDirectory . DIRECTORY_SEPARATOR . $table->phpName . 'TableMap.php', $template); |
|
64 | + file_put_contents($outputDirectory.DIRECTORY_SEPARATOR.$table->phpName.'TableMap.php', $template); |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 | } |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | $this->modelNamespace = $modelNamespace; |
46 | 46 | |
47 | 47 | $loader = new \Twig_Loader_Filesystem(array_merge($templateDirs, [ |
48 | - __DIR__ . '/../../Resources/Skeletons/Model/Query' |
|
48 | + __DIR__.'/../../Resources/Skeletons/Model/Query' |
|
49 | 49 | ])); |
50 | - $loader->addPath(__DIR__ . '/../../Resources/Skeletons/Model/Query/Driver/SQLite', 'sqlite'); |
|
50 | + $loader->addPath(__DIR__.'/../../Resources/Skeletons/Model/Query/Driver/SQLite', 'sqlite'); |
|
51 | 51 | |
52 | 52 | $this->twig = new \Twig_Environment($loader, [ |
53 | 53 | 'cache' => false, |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $this->createDirectory($outputDirectory); |
70 | 70 | |
71 | 71 | foreach ($schema->getTables() as $table) { |
72 | - $outputFile = $outputDirectory . DIRECTORY_SEPARATOR . $table->phpName . 'Query.php'; |
|
72 | + $outputFile = $outputDirectory.DIRECTORY_SEPARATOR.$table->phpName.'Query.php'; |
|
73 | 73 | |
74 | 74 | // Check if file already exists, do not override the file |
75 | 75 | if (is_file($outputFile)) { |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | protected function generateBase(Schema $schema) |
91 | 91 | { |
92 | - $outputDirectory = $schema->absoluteDirectory . DIRECTORY_SEPARATOR . 'Base'; |
|
92 | + $outputDirectory = $schema->absoluteDirectory.DIRECTORY_SEPARATOR.'Base'; |
|
93 | 93 | $this->createDirectory($outputDirectory); |
94 | 94 | |
95 | 95 | // Allow overriding template for a given driver |
@@ -97,14 +97,14 @@ discard block |
||
97 | 97 | |
98 | 98 | foreach ($schema->getTables() as $table) { |
99 | 99 | $template = $this->twig->resolveTemplate([ |
100 | - '@' . $driver . '/base_query.php.twig', |
|
100 | + '@'.$driver.'/base_query.php.twig', |
|
101 | 101 | 'base_query.php.twig' |
102 | 102 | ])->render([ |
103 | 103 | 'table' => $table, |
104 | 104 | 'driver' => $driver |
105 | 105 | ]); |
106 | 106 | |
107 | - file_put_contents($outputDirectory . DIRECTORY_SEPARATOR . 'Base' . $table->phpName . 'Query.php', $template); |
|
107 | + file_put_contents($outputDirectory.DIRECTORY_SEPARATOR.'Base'.$table->phpName.'Query.php', $template); |
|
108 | 108 | } |
109 | 109 | } |
110 | 110 | } |
@@ -40,21 +40,21 @@ discard block |
||
40 | 40 | $this->modelNamespace = $modelNamespace; |
41 | 41 | |
42 | 42 | $loader = new \Twig_Loader_Filesystem(array_merge($templateDirs, [ |
43 | - __DIR__ . '/../../Resources/Skeletons/Model/Object' |
|
43 | + __DIR__.'/../../Resources/Skeletons/Model/Object' |
|
44 | 44 | ])); |
45 | - $loader->addPath(__DIR__ . '/../../Resources/Skeletons/Model/Object/Driver/SQLite', 'sqlite'); |
|
45 | + $loader->addPath(__DIR__.'/../../Resources/Skeletons/Model/Object/Driver/SQLite', 'sqlite'); |
|
46 | 46 | |
47 | 47 | $this->twig = new \Twig_Environment($loader, [ |
48 | 48 | 'cache' => false, |
49 | 49 | 'strict_variables' => true |
50 | 50 | ]); |
51 | 51 | |
52 | - $this->twig->addFilter(new \Twig_SimpleFilter('type', function ($variable, $type) { |
|
52 | + $this->twig->addFilter(new \Twig_SimpleFilter('type', function($variable, $type) { |
|
53 | 53 | switch ($type) { |
54 | 54 | case 'string': return is_string($variable); |
55 | 55 | } |
56 | 56 | |
57 | - throw new \LogicException('Unknown type "' . $type . '" for the Twig filter "type"'); |
|
57 | + throw new \LogicException('Unknown type "'.$type.'" for the Twig filter "type"'); |
|
58 | 58 | })); |
59 | 59 | } |
60 | 60 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $this->createDirectory($outputDirectory); |
73 | 73 | |
74 | 74 | foreach ($schema->getTables() as $table) { |
75 | - $outputFile = $outputDirectory . DIRECTORY_SEPARATOR . $table->phpName . '.php'; |
|
75 | + $outputFile = $outputDirectory.DIRECTORY_SEPARATOR.$table->phpName.'.php'; |
|
76 | 76 | |
77 | 77 | // Check if file already exists, do not override the file |
78 | 78 | if (is_file($outputFile)) { |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | protected function generateBase(Schema $schema) |
94 | 94 | { |
95 | - $outputDirectory = $schema->absoluteDirectory . DIRECTORY_SEPARATOR . 'Base'; |
|
95 | + $outputDirectory = $schema->absoluteDirectory.DIRECTORY_SEPARATOR.'Base'; |
|
96 | 96 | $this->createDirectory($outputDirectory); |
97 | 97 | |
98 | 98 | // Allow overriding template for a given driver |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | |
101 | 101 | foreach ($schema->getTables() as $table) { |
102 | 102 | $template = $this->twig->resolveTemplate([ |
103 | - '@' . $driver . '/base_object.php.twig', |
|
103 | + '@'.$driver.'/base_object.php.twig', |
|
104 | 104 | 'base_object.php.twig' |
105 | 105 | ])->render([ |
106 | 106 | 'table' => $table, |
107 | 107 | 'driver' => $driver |
108 | 108 | ]); |
109 | 109 | |
110 | - file_put_contents($outputDirectory . DIRECTORY_SEPARATOR . 'Base' . $table->phpName . '.php', $template); |
|
110 | + file_put_contents($outputDirectory.DIRECTORY_SEPARATOR.'Base'.$table->phpName.'.php', $template); |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | } |
@@ -24,8 +24,8 @@ |
||
24 | 24 | if (!is_dir($directory)) { |
25 | 25 | if (!@mkdir($directory, 755, true)) { |
26 | 26 | throw new \RuntimeException( |
27 | - 'The generator "' . end(explode('\\', get_called_class())) . '" cannot create directory "' |
|
28 | - . $directory . '", error message : ' . error_get_last()['message'] |
|
27 | + 'The generator "'.end(explode('\\', get_called_class())).'" cannot create directory "' |
|
28 | + . $directory.'", error message : '.error_get_last()['message'] |
|
29 | 29 | ); |
30 | 30 | } |
31 | 31 | } |