에 내 번들을 만들려고합니다. 이 튜토리얼에서는 "Acme"번들을 만드는 과정을 안내합니다. Acme Demo 번들과 함께 제공된 심포니 2.4를 다운로드 한 이래로. 모든 "AcmeBundle"을 "myAcmeBundle"로 변경했습니다. 나는 번들의 이름을 제외하고 명령과 정확히 같은 컨트롤러, 라우트 및 번들을 생성했다.symfony 어느 번들을 실행하고 있습니까
혀를 내가
http://localhost/app_dev.php/hello/Ryan
에 가면 내 질문 심포니 번들되는 알고 어떻게 실행할 것입니다 내 HelloController.php 를 호출 할 필요가 있다고 말한다. 내 "src"폴더에 2 번들이 있습니다. localhost/app_dev.php/hello/Ryan을 입력하면 HelloController.php의 내용이 AcmeBundle (기본 데모 번들)에 표시됩니다. HelloController.php의 내용을 myAcmeBundle (내 새로 만든 번들)에 표시하고 싶습니다.
추가 정보 : 클래스 AppKernel과 관련이있다 어쩌면 무언가하지만, 아주 확실하지
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new myAcme\HelloBundle\myAcmeHelloBundle(),
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Acme\DemoBundle\AcmeDemoBundle();
//$bundles[] = new myAcme\HelloBundle\myAcmeHelloBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
}
return $bundles;
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
}
}
응용 프로그램 \ 설정 \ routing.yml SRC
my_acme_hello:
resource: "@myAcmeHelloBundle/Resources/config/routing.yml"
prefix: /
\ myAcme \ HelloBundle \ Resources \ config \ routing.yml
my_acme_hello_homepage:
path: /hello/{name}
defaults: { _controller: myAcmeHelloBundle:Default:index }
의 "안녕하세요"컨트롤러 라우팅 설정 [this] (http://symfony.com/doc/current/book/routing.html) 페이지를 읽었습니까? – bzeaman
'src/Acme/HelloBundle/Resources/config/routing.yml'에서 라우팅 항목을 제거 했습니까? 먼저 일치하는 것이 발견되면 컨트롤러를 선택하는 데 사용됩니다. – bzeaman