尝试更新时出错:架构

时间:2016-02-25 07:53:29

标签: php symfony

[学说\共同\持久性\映射\ MappingException]

Class'Cunningsoft \ ChatBundle \ Entity \ AuthorInterface'不存在。

当我在AppKernel.php中插入(新的Cunningsoft \ ChatBundle \ CunningsoftChatBundle(),)并且在我的实体中的implements(AuthorInterface)之后无法更新:此错误的架构时,会发生此错误。 enter image description here

<?php
//AppKernel.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 Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
            new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
            new AppBundle\AppBundle(),
            new helloBundle\helloBundle(),
            new RegBundle\RegBundle(),
            new IndexBundle\IndexBundle(),
            new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(),   
            new Cunningsoft\ChatBundle\CunningsoftChatBundle(),
            new Knp\Bundle\TimeBundle\KnpTimeBundle(),
        );

        if (in_array($this->getEnvironment(), array('dev', 'test'), true)) {
            $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
            $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($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
    }
}

1 个答案:

答案 0 :(得分:0)

您应该将界面映射到用户实体

// app/config/config.yml
// ...
doctrine:
    orm:
        resolve_target_entities:
            Cunningsoft\ChatBundle\Entity\AuthorInterface: Acme\ProjectBundle\Entity\User