Fixed init:bundle
This commit is contained in:
parent
4e0ecfdf81
commit
1e793a2500
@ -51,13 +51,13 @@ class InitBundleCommand extends Command
|
||||
throw new \InvalidArgumentException('The namespace must end with Bundle.');
|
||||
}
|
||||
|
||||
$pos = strrpos($namespace, '\\');
|
||||
$bundle = substr($namespace, $pos ? $pos + 1 : 0);
|
||||
$bundle = strtr($namespace, array('\\' => ''));
|
||||
|
||||
$dir = $input->getArgument('dir');
|
||||
$targetDir = $dir . strtr($namespace, '\\', '/');
|
||||
$output->writeln(sprintf('Initializing bundle "<info>%s</info>" in "<info>%s</info>"', $bundle, $dir));
|
||||
|
||||
if (file_exists($targetDir = $dir.'/'.$bundle)) {
|
||||
if (file_exists($targetDir)) {
|
||||
throw new \RuntimeException(sprintf('Bundle "%s" already exists.', $bundle));
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace {{ namespace }}\{{ bundle }};
|
||||
namespace {{ namespace }};
|
||||
|
||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
|
||||
class {{ bundle }} extends Bundle
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getNamespace()
|
||||
{
|
||||
return __NAMESPACE__;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getPath()
|
||||
{
|
||||
return strtr(__DIR__, '\\', '/');
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace {{ namespace }}\{{ bundle }}\Controller;
|
||||
namespace {{ namespace }}\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
|
||||
|
Reference in New Issue
Block a user