Symfony 3:如何访问AppBundle / Controller外部的控制器?

时间:2016-12-14 23:09:56

标签: php controller symfony

我尝试以可以访问AppBundle / Controller之外的文件夹中的控制器的方式配置我的routing.yml。

我有一个控制器" AController"在AppBundle / it

<?php

namespace AppBundle\it;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class AController extends Controller
{
    /**
     * @Route("/a")
     * @param $name
     * @return \Symfony\Component\HttpFoundation\Response
     */
    public function indexAction($name)
    {
        return $this->render('', array('name' => $name));
    }
}

这是routing.yml文件:

app:
resource: "@AppBundle/it/"

type:     annotation

当我尝试调用此控制器时,我得到了这个例外:

Class \Account does not exist in `B:\xampp\htdocs\YourTeam\src\AppBundle/it/     (which is being imported from   "B:\xampp\htdocs\YourTeam\app/config\routing.yml").`
500 Internal Server Error - FileLoaderLoadException
1 linked Exception: ReflectionException »

0 个答案:

没有答案