@@ 135-155 (lines=21) @@ | ||
132 | * |
|
133 | * @throws \Exception |
|
134 | */ |
|
135 | protected function checkForUnfinishedImports(Feed $feed, InputInterface $input, OutputInterface $output) |
|
136 | { |
|
137 | $helper = new QuestionHelper(); |
|
138 | ||
139 | foreach ($feed->getImports() as $import) { |
|
140 | if (!$import->isFinished()) { |
|
141 | $msg = sprintf( |
|
142 | 'Import <info>%d</info> for this feed is unfinished, close it now? [y] ', |
|
143 | $import->getId() |
|
144 | ); |
|
145 | ||
146 | $question = new ConfirmationQuestion($msg); |
|
147 | if ($helper->ask($input, $output, $question)) { |
|
148 | $command = 'io:import:close'; |
|
149 | $closeImport = $this->getApplication()->find($command); |
|
150 | $input = new ArrayInput(['command' => $command, 'import' => $import->getId()]); |
|
151 | $closeImport->run($input, $output); |
|
152 | } |
|
153 | } |
|
154 | } |
|
155 | } |
|
156 | ||
157 | /** |
|
158 | * @return FeedRepository |
@@ 169-189 (lines=21) @@ | ||
166 | * |
|
167 | * @throws \Exception |
|
168 | */ |
|
169 | protected function checkForUnfinishedImports(Feed $feed, InputInterface $input, OutputInterface $output) |
|
170 | { |
|
171 | $helper = new QuestionHelper(); |
|
172 | ||
173 | foreach ($feed->getImports() as $import) { |
|
174 | if (!$import->isFinished()) { |
|
175 | $msg = sprintf( |
|
176 | 'Import <info>%d</info> for this feed is unfinished, close it now? [y] ', |
|
177 | $import->getId() |
|
178 | ); |
|
179 | ||
180 | $question = new ConfirmationQuestion($msg); |
|
181 | if ($helper->ask($input, $output, $question)) { |
|
182 | $command = 'io:import:close'; |
|
183 | $closeImport = $this->getApplication()->find($command); |
|
184 | $input = new ArrayInput(['command' => $command, 'import' => $import->getId()]); |
|
185 | $closeImport->run($input, $output); |
|
186 | } |
|
187 | } |
|
188 | } |
|
189 | } |
|
190 | } |
|
191 |