Skip to content

Commit 9c575c6

Browse files
committed
enforce error message if bundle argument is set
This fixes propelorm#180. The kernel will throw an exception if the bundle could not be found, which also contains the name of the bundle.
1 parent 88454b7 commit 9c575c6

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

Command/AbstractCommand.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,13 @@ protected function initialize(InputInterface $input, OutputInterface $output)
128128

129129
$this->checkConfiguration();
130130

131-
if ($input->hasArgument('bundle') && '@' === substr($input->getArgument('bundle'), 0, 1)) {
132-
$this->bundle = $this
133-
->getContainer()
134-
->get('kernel')
135-
->getBundle(substr($input->getArgument('bundle'), 1));
131+
if ($input->hasArgument('bundle')) {
132+
$bundleName = $input->getArgument('bundle');
133+
if (0 === strpos($bundleName, '@')) {
134+
$bundleName = substr($bundleName, 1);
135+
}
136+
137+
$this->bundle = $this->getContainer()->get('kernel')->getBundle($bundleName);
136138
}
137139
}
138140

0 commit comments

Comments
 (0)