另一个"在链配置的命名空间中找不到类'X'

Eag*_*le1 3 flush persist symfony doctrine-orm

当我坚持我的实体时,我收到此错误

另一个"在链配置的命名空间中找不到类'X'

在我将Symfony从Windows移动到Linux之前,这曾经工作过.

我的控制器:

public function SubscriptionHandlingAction(Request $request)
{

        if ($request->isMethod('POST')) 
        {

            $form = $this->createForm(new NewCustomer(), new Customer());
            $form->bind($request);

            if ($form->isValid()) 
            {

                // get the form data 
                $newcustomer = $form->getData();                    

                //get the date and set it in the entity
                $datecreation = new \DateTime(date('d-m-Y'));                     
                $newcustomer->setdatecreation($datecreation);

                //this works fine
                echo $newcustomer->getname();

                //persist the data
                $em = $this->getDoctrine()->getManager();
                $em->persist($newcustomer);
                $em->flush();


                return $this->render('NRtworksSubscriptionBundle:Subscription:subscription_success.html.twig');  

            }
Run Code Online (Sandbox Code Playgroud)

当然,我的类实体存在,因为我可以基于它创建表单,对象等.但是,这个实体不是"映射"意味着教义:mapping:info不给我任何东西(但是我手动创建了相应的sdl表并放入所有注释):

<?php

namespace NRtworks\SubscriptionBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;


/**
 * @ORM\Entity
 * @ORM\Table(name="Customer")
 */
class Customer
{

    /**
 * @ORM\Id
 * @ORM\Column(type="integer")
 * @ORM\GeneratedValue(strategy="AUTO")
 */

protected $idCustomer;

/**
 * @ORM\Column(type="string", length=100, unique = true)
 */

protected $name;  

 /**
 * @ORM\Column(type="string", length=50)
 */

protected $country;

 /**
 * @ORM\Column(type="datetime", nullable = false)
 */

protected $datecreation;

   /**
 * @ORM\Column(type="integer", length = 5, nullable = false)
 */

protected $admin_user;

//getter
// no need for that
// setter
// no need for that

}

?>
Run Code Online (Sandbox Code Playgroud)

问题的任何提示?

十分感谢

sjt*_*003 5

您是与多个实体经理或连接合作吗?确保每个em与config.yml下的相应包匹配

doctrine:
  dbal:
    #connection info (driver/host/port/...)
  orm:
    entity_managers:
      manager_one:
      connection:  # your connection (eg: 'default:'
        mappings:
          YourRespectiveBundle: ~
          AnotherrespectiveBundle: ~
Run Code Online (Sandbox Code Playgroud)

这是我第一次使用多个ems时绊倒了我.否则,请检查AppKernel.php中的bundle,并仔细检查db连接是否正确.