| @@ 90-126 (lines=37) @@ | ||
| 87 | * @return mixed |
|
| 88 | * @throws \Exception |
|
| 89 | */ |
|
| 90 | protected function getSeedPath(InputInterface $input, OutputInterface $output) |
|
| 91 | { |
|
| 92 | // First, try the non-interactive option: |
|
| 93 | $path = $input->getOption('path'); |
|
| 94 | ||
| 95 | if (!empty($path)) { |
|
| 96 | return $path; |
|
| 97 | } |
|
| 98 | ||
| 99 | $paths = $this->getConfig()->getSeedPaths(); |
|
| 100 | ||
| 101 | // No paths? That's a problem. |
|
| 102 | if (empty($paths)) { |
|
| 103 | throw new \Exception('No seed paths set in your Phinx configuration file.'); |
|
| 104 | } |
|
| 105 | ||
| 106 | $paths = Util::globAll($paths); |
|
| 107 | ||
| 108 | if (empty($paths)) { |
|
| 109 | throw new \Exception( |
|
| 110 | 'You probably used curly braces to define seed path in your Phinx configuration file, ' . |
|
| 111 | 'but no directories have been matched using this pattern. ' . |
|
| 112 | 'You need to create a seed directory manually.' |
|
| 113 | ); |
|
| 114 | } |
|
| 115 | ||
| 116 | // Only one path set, so select that: |
|
| 117 | if (1 === count($paths)) { |
|
| 118 | return array_shift($paths); |
|
| 119 | } |
|
| 120 | ||
| 121 | // Ask the user which of their defined paths they'd like to use: |
|
| 122 | $helper = $this->getHelper('question'); |
|
| 123 | $question = $this->getSelectSeedPathQuestion($paths); |
|
| 124 | ||
| 125 | return $helper->ask($input, $output, $question); |
|
| 126 | } |
|
| 127 | ||
| 128 | /** |
|
| 129 | * Create the new seeder. |
|
| @@ 104-140 (lines=37) @@ | ||
| 101 | * @return mixed |
|
| 102 | * @throws \Exception |
|
| 103 | */ |
|
| 104 | protected function getMigrationPath(InputInterface $input, OutputInterface $output) |
|
| 105 | { |
|
| 106 | // First, try the non-interactive option: |
|
| 107 | $path = $input->getOption('path'); |
|
| 108 | ||
| 109 | if (!empty($path)) { |
|
| 110 | return $path; |
|
| 111 | } |
|
| 112 | ||
| 113 | $paths = $this->getConfig()->getMigrationPaths(); |
|
| 114 | ||
| 115 | // No paths? That's a problem. |
|
| 116 | if (empty($paths)) { |
|
| 117 | throw new \Exception('No migration paths set in your Phinx configuration file.'); |
|
| 118 | } |
|
| 119 | ||
| 120 | $paths = Util::globAll($paths); |
|
| 121 | ||
| 122 | if (empty($paths)) { |
|
| 123 | throw new \Exception( |
|
| 124 | 'You probably used curly braces to define migration path in your Phinx configuration file, ' . |
|
| 125 | 'but no directories have been matched using this pattern. ' . |
|
| 126 | 'You need to create a migration directory manually.' |
|
| 127 | ); |
|
| 128 | } |
|
| 129 | ||
| 130 | // Only one path set, so select that: |
|
| 131 | if (1 === count($paths)) { |
|
| 132 | return array_shift($paths); |
|
| 133 | } |
|
| 134 | ||
| 135 | // Ask the user which of their defined paths they'd like to use: |
|
| 136 | $helper = $this->getHelper('question'); |
|
| 137 | $question = $this->getSelectMigrationPathQuestion($paths); |
|
| 138 | ||
| 139 | return $helper->ask($input, $output, $question); |
|
| 140 | } |
|
| 141 | ||
| 142 | /** |
|
| 143 | * Create the new migration. |
|