[英]Doctrine annotation error in production server
我在生产服务器
中出现
错误,该错误
在我的本地主机中未发生
:
AnnotationException: [Semantical Error]
The annotation "@Sensio\Bundle\FrameworkExtraBundle\Configuration\Route" in method My\Bundle\Controller\MyController::indexAction() does not exist, or could not be auto-loaded.
在当地这个错误发生时,我tryed更新一些封装, 作曲家 , 这并没有解决这个问题,我不得不重新安装Symfony和重新上传一切,仍在进行之中 。
缓存已清除,所以我想这不是缓存。
<?php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
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 JMS\AopBundle\JMSAopBundle(),
new JMS\DiExtraBundle\JMSDiExtraBundle($this),
new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
new MyProject\PanelBundle\MyProjectPanelBundle(),
new MyProject\ProductBundle\MyProjectProductBundle(),
new Front\SiteBundle\FrontSiteBundle(),
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Acme\DemoBundle\AcmeDemoBundle();
$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');
}
}
并在控制器中引发错误的示例注释:
/**
* Lists all MyEnt entities.
*
* @Route("/", name="my_ent")
* @Method("GET")
* @Template("MyProjectPanelBundle:MyEnt:index.html.twig")
*/
public function indexAction($ident)
{
front_site:
resource: "@FrontSiteBundle/Resources/config/routing.yml"
prefix: /
MyProject_product:
resource: "@MyProjectProductBundle/Resources/config/routing.yml"
prefix: /
MyProject_panel:
resource: "@MyProjectPanelBundle/Resources/config/routing.yml"
prefix: /
我有类似的问题。
使用require_once导入Sensio \\ Bundle \\ FrameworkExtraBundle \\ Configuration \\ Route类可以解决此问题。
require_once __DIR__ . '/../vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Configuration/Route.php';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.