子类“”不是有效实体或映射超类

时间:2013-11-27 09:31:12

标签: xml symfony doctrine-orm

我有以下Entity类和map xml文件, 调用此实体时会收到此错误:“Class”Holcim \ AdminBundle \ Entity \ CHINESEMaster“子类”“不是有效实体或映射超类。”

实体类     

namespace Holcim\AdminBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Holcim\AdminBundle\Entity\DatasheetMaster
 */
class DatasheetMaster
{
    /**
     * @var string $year
     */
    private $year;

    /**
     * @var string $month
     */
    private $month;

    /**
     * @var \DateTime $dateAdded
     */
    private $dateAdded;

    /**
     * @var \DateTime $dateApproved
     */
    private $dateApproved;

    /**
     * @var \DateTime $dateDeleted
     */
    private $dateDeleted;

    /**
     * @var integer $status
     */
    private $status;

    /**
     * @var \DateTime $asoApproveDate
     */
    private $asoApproveDate;

    /**
     * @var \DateTime $asoDeleteDate
     */
    private $asoDeleteDate;

    /**
     * @var integer $asoStatus
     */
    private $asoStatus;

    /**
     * @var \DateTime $rsmApproveDate
     */
    private $rsmApproveDate;

    /**
     * @var \DateTime $rsmDeleteDate
     */
    private $rsmDeleteDate;

    /**
     * @var integer $rsmStatus
     */
    private $rsmStatus;

    /**
     * @var integer $id
     */
    private $id;

    /**
     * @var Holcim\AdminBundle\Entity\Customers
     */
    private $distributor;


    /**
     * Set year
     *
     * @param string $year
     * @return DatasheetMaster
     */
    public function setYear($year)
    {
        $this->year = $year;

        return $this;
    }

    /**
     * Get year
     *
     * @return string 
     */
    public function getYear()
    {
        return $this->year;
    }

    /**
     * Set month
     *
     * @param string $month
     * @return DatasheetMaster
     */
    public function setMonth($month)
    {
        $this->month = $month;

        return $this;
    }

    /**
     * Get month
     *
     * @return string 
     */
    public function getMonth()
    {
        return $this->month;
    }

    /**
     * Set dateAdded
     *
     * @param \DateTime $dateAdded
     * @return DatasheetMaster
     */
    public function setDateAdded($dateAdded)
    {
        $this->dateAdded = $dateAdded;

        return $this;
    }

    /**
     * Get dateAdded
     *
     * @return \DateTime 
     */
    public function getDateAdded()
    {
        return $this->dateAdded;
    }

    /**
     * Set dateApproved
     *
     * @param \DateTime $dateApproved
     * @return DatasheetMaster
     */
    public function setDateApproved($dateApproved)
    {
        $this->dateApproved = $dateApproved;

        return $this;
    }

    /**
     * Get dateApproved
     *
     * @return \DateTime 
     */
    public function getDateApproved()
    {
        return $this->dateApproved;
    }

    /**
     * Set dateDeleted
     *
     * @param \DateTime $dateDeleted
     * @return DatasheetMaster
     */
    public function setDateDeleted($dateDeleted)
    {
        $this->dateDeleted = $dateDeleted;

        return $this;
    }

    /**
     * Get dateDeleted
     *
     * @return \DateTime 
     */
    public function getDateDeleted()
    {
        return $this->dateDeleted;
    }

    /**
     * Set status
     *
     * @param integer $status
     * @return DatasheetMaster
     */
    public function setStatus($status)
    {
        $this->status = $status;

        return $this;
    }

    /**
     * Get status
     *
     * @return integer 
     */
    public function getStatus()
    {
        return $this->status;
    }

    /**
     * Set asoApproveDate
     *
     * @param \DateTime $asoApproveDate
     * @return DatasheetMaster
     */
    public function setAsoApproveDate($asoApproveDate)
    {
        $this->asoApproveDate = $asoApproveDate;

        return $this;
    }

    /**
     * Get asoApproveDate
     *
     * @return \DateTime 
     */
    public function getAsoApproveDate()
    {
        return $this->asoApproveDate;
    }

    /**
     * Set asoDeleteDate
     *
     * @param \DateTime $asoDeleteDate
     * @return DatasheetMaster
     */
    public function setAsoDeleteDate($asoDeleteDate)
    {
        $this->asoDeleteDate = $asoDeleteDate;

        return $this;
    }

    /**
     * Get asoDeleteDate
     *
     * @return \DateTime 
     */
    public function getAsoDeleteDate()
    {
        return $this->asoDeleteDate;
    }

    /**
     * Set asoStatus
     *
     * @param integer $asoStatus
     * @return DatasheetMaster
     */
    public function setAsoStatus($asoStatus)
    {
        $this->asoStatus = $asoStatus;

        return $this;
    }

    /**
     * Get asoStatus
     *
     * @return integer 
     */
    public function getAsoStatus()
    {
        return $this->asoStatus;
    }

    /**
     * Set rsmApproveDate
     *
     * @param \DateTime $rsmApproveDate
     * @return DatasheetMaster
     */
    public function setRsmApproveDate($rsmApproveDate)
    {
        $this->rsmApproveDate = $rsmApproveDate;

        return $this;
    }

    /**
     * Get rsmApproveDate
     *
     * @return \DateTime 
     */
    public function getRsmApproveDate()
    {
        return $this->rsmApproveDate;
    }

    /**
     * Set rsmDeleteDate
     *
     * @param \DateTime $rsmDeleteDate
     * @return DatasheetMaster
     */
    public function setRsmDeleteDate($rsmDeleteDate)
    {
        $this->rsmDeleteDate = $rsmDeleteDate;

        return $this;
    }

    /**
     * Get rsmDeleteDate
     *
     * @return \DateTime 
     */
    public function getRsmDeleteDate()
    {
        return $this->rsmDeleteDate;
    }

    /**
     * Set rsmStatus
     *
     * @param integer $rsmStatus
     * @return DatasheetMaster
     */
    public function setRsmStatus($rsmStatus)
    {
        $this->rsmStatus = $rsmStatus;

        return $this;
    }

    /**
     * Get rsmStatus
     *
     * @return integer 
     */
    public function getRsmStatus()
    {
        return $this->rsmStatus;
    }

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set distributor
     *
     * @param Holcim\AdminBundle\Entity\Customers $distributor
     * @return DatasheetMaster
     */
    public function setDistributor(\Holcim\AdminBundle\Entity\Customers $distributor = null)
    {
        $this->distributor = $distributor;

        return $this;
    }

    /**
     * Get distributor
     *
     * @return Holcim\AdminBundle\Entity\Customers 
     */
    public function getDistributor()
    {
        return $this->distributor;
    }
}

xml文件:

<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
  <entity name="Holcim\AdminBundle\Entity\DatasheetMaster" table="datasheet_master">
    <id name="id" type="integer" column="id">
      <generator strategy="IDENTITY"/>
    </id>
    <field name="year" type="string" column="year" length="10" nullable="false"/>
    <field name="month" type="string" column="month" length="20" nullable="false"/>
    <field name="dateAdded" type="date" column="date_added" nullable="false"/>
    <field name="dateApproved" type="date" column="date_approved" nullable="true"/>
    <field name="dateDeleted" type="date" column="date_deleted" nullable="true"/>
    <field name="status" type="integer" column="status" nullable="false"/>
    <field name="asoApproveDate" type="date" column="aso_approve_date" nullable="true"/>
    <field name="asoDeleteDate" type="date" column="aso_delete_date" nullable="true"/>
    <field name="asoStatus" type="integer" column="aso_status" nullable="false"/>
    <field name="rsmApproveDate" type="date" column="rsm_approve_date" nullable="true"/>
    <field name="rsmDeleteDate" type="date" column="rsm_delete_date" nullable="true"/>
    <field name="rsmStatus" type="integer" column="rsm_status" nullable="false"/>
    <many-to-one field="distributor" target-entity="Customers">
      <join-columns>
        <join-column name="distributor_id" referenced-column-name="id"/>
      </join-columns>
    </many-to-one>
  </entity>
</doctrine-mapping>

1 个答案:

答案 0 :(得分:0)

试试这个:将您的实体修改为:

/**
 * Holcim\AdminBundle\Entity\DatasheetMaster
 * @ORM\Entity                                      // add this line
 */
class DatasheetMaster
{
...
}