Merge remote branch 'Seldaek/init_bundle'

* Seldaek/init_bundle:
  [FrameworkBundle] Allow init:bundle to be called with / as namespace separator
This commit is contained in:
Fabien Potencier 2011-04-11 18:39:36 +02:00
commit 27d2b049f8

View File

@ -66,6 +66,7 @@ EOT
} }
// validate namespace // validate namespace
$namespace = strtr($namespace, '/', '\\');
if (preg_match('/[^A-Za-z0-9_\\\-]/', $namespace)) { if (preg_match('/[^A-Za-z0-9_\\\-]/', $namespace)) {
throw new \InvalidArgumentException('The namespace contains invalid characters.'); throw new \InvalidArgumentException('The namespace contains invalid characters.');
} }
@ -96,8 +97,6 @@ EOT
$targetDir = $dir.strtr($namespace, '\\', '/'); $targetDir = $dir.strtr($namespace, '\\', '/');
if (file_exists($targetDir)) { if (file_exists($targetDir)) {
throw new \RuntimeException(sprintf('Bundle "%s" already exists.', $bundle)); throw new \RuntimeException(sprintf('Bundle "%s" already exists.', $bundle));
} }