| @@ 281-314 (lines=34) @@ | ||
| 278 | return $filename; |
|
| 279 | } |
|
| 280 | ||
| 281 | private function makeMigration($pluginCode, $metadetas) |
|
| 282 | { |
|
| 283 | if ($this->paramList['supportFlag']['value']) { |
|
| 284 | $migrationFileCont = file_get_contents($this->app['config']['root_dir'] . '/src/Eccube/Command/PluginCommand/Resource/MigrationVersionSupport.php'); |
|
| 285 | } else { |
|
| 286 | $migrationFileCont = file_get_contents($this->app['config']['root_dir'] . '/src/Eccube/Command/PluginCommand/Resource/MigrationVersion.php'); |
|
| 287 | } |
|
| 288 | ||
| 289 | $entityList = $this->createEntityList($pluginCode, $metadetas); |
|
| 290 | ||
| 291 | $entityListStr = join(',' . PHP_EOL, $entityList); |
|
| 292 | $migrationFileCont = str_replace('[entityList]', $entityListStr, $migrationFileCont); |
|
| 293 | if ($this->paramList['supportFlag']['value']) { |
|
| 294 | $createParts = $this->makeCreateParts($metadetas); |
|
| 295 | $tableNameArr = array(); |
|
| 296 | foreach ($createParts as $tableName => $tableArr) { |
|
| 297 | $tableNameArr[] = ' $this->createTable' . $tableName . '($schema);'; |
|
| 298 | } |
|
| 299 | $tableNameStr = join(PHP_EOL, $tableNameArr); |
|
| 300 | $migrationFileCont = str_replace('[createTable]', $tableNameStr, $migrationFileCont); |
|
| 301 | ||
| 302 | $createPartsStr = ''; |
|
| 303 | foreach ($createParts as $parts) { |
|
| 304 | $createPartsStr .= join(PHP_EOL, $parts); |
|
| 305 | } |
|
| 306 | $migrationFileCont = str_replace('[createFunction]', $createPartsStr, $migrationFileCont); |
|
| 307 | ||
| 308 | $dropParts = $this->makeDropParts($metadetas); |
|
| 309 | $dropPartsStr = join(PHP_EOL, $dropParts); |
|
| 310 | $migrationFileCont = str_replace('[dropTable]', $dropPartsStr, $migrationFileCont); |
|
| 311 | } |
|
| 312 | ||
| 313 | return $migrationFileCont; |
|
| 314 | } |
|
| 315 | ||
| 316 | private function createEntityList($pluginCode, $migrations) |
|
| 317 | { |
|
| @@ 459-493 (lines=35) @@ | ||
| 456 | return join(PHP_EOL, $line); |
|
| 457 | } |
|
| 458 | ||
| 459 | private function makeMigration($pluginCode, $migration) |
|
| 460 | { |
|
| 461 | if ($this->paramList['supportFlag']['value']) { |
|
| 462 | $migrationFileCont = file_get_contents($this->app['config']['root_dir'] . '/src/Eccube/Command/PluginCommand/Resource/MigrationVersionSupport.php'); |
|
| 463 | } else { |
|
| 464 | $migrationFileCont = file_get_contents($this->app['config']['root_dir'] . '/src/Eccube/Command/PluginCommand/Resource/MigrationVersion.php'); |
|
| 465 | } |
|
| 466 | ||
| 467 | $entityList = $this->createEntityList($pluginCode, $migration); |
|
| 468 | ||
| 469 | $entityListStr = join(',' . PHP_EOL, $entityList); |
|
| 470 | $migrationFileCont = str_replace('[entityList]', $entityListStr, $migrationFileCont); |
|
| 471 | ||
| 472 | if ($this->paramList['supportFlag']['value']) { |
|
| 473 | $createParts = $this->makeCreateParts($migration); |
|
| 474 | $tableNameArr = array(); |
|
| 475 | foreach ($createParts as $tableName => $tableArr) { |
|
| 476 | $tableNameArr[] = ' $this->createTable' . $tableName . '($schema);'; |
|
| 477 | } |
|
| 478 | $tableNameStr = join(PHP_EOL, $tableNameArr); |
|
| 479 | $migrationFileCont = str_replace('[createTable]', $tableNameStr, $migrationFileCont); |
|
| 480 | ||
| 481 | $createPartsStr = ''; |
|
| 482 | foreach ($createParts as $parts) { |
|
| 483 | $createPartsStr .= join(PHP_EOL, $parts); |
|
| 484 | } |
|
| 485 | $migrationFileCont = str_replace('[createFunction]', $createPartsStr, $migrationFileCont); |
|
| 486 | ||
| 487 | $dropParts = $this->makeDropParts($migration); |
|
| 488 | $dropPartsStr = join(PHP_EOL, $dropParts); |
|
| 489 | $migrationFileCont = str_replace('[dropTable]', $dropPartsStr, $migrationFileCont); |
|
| 490 | } |
|
| 491 | ||
| 492 | return $migrationFileCont; |
|
| 493 | } |
|
| 494 | ||
| 495 | private function createEntityList($pluginCode, $migration) |
|
| 496 | { |
|