1

这是我的 Doctrine2 注释文件,它返回了这个错误

MappingException:没有为实体“WbsGo\clientsBundle\Entity\VtigerPortalinfo”指定标识符/主键。每个实体都必须有一个标识符/主键。

在DB中,字段ID设置为主键...所以我不知道问题出在哪里......

<?php

namespace WbsGo\clientsBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * VtigerPortalinfo
 */
class VtigerPortalinfo
{
    /**
     * @var string
     */
    private $userName;

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

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

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

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

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

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

    /**
     * @var \WbsGo\clientsBundle\Entity\VtigerContactdetails
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;


    /**
     * Set userName
     *
     * @param string $userName
     * @return VtigerPortalinfo
     */
    public function setUserName($userName)
    {
        $this->userName = $userName;

        return $this;
    }

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

    /**
     * Set userPassword
     *
     * @param string $userPassword
     * @return VtigerPortalinfo
     */
    public function setUserPassword($userPassword)
    {
        $this->userPassword = $userPassword;

        return $this;
    }

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

    /**
     * Set type
     *
     * @param string $type
     * @return VtigerPortalinfo
     */
    public function setType($type)
    {
        $this->type = $type;

        return $this;
    }

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

    /**
     * Set lastLoginTime
     *
     * @param \DateTime $lastLoginTime
     * @return VtigerPortalinfo
     */
    public function setLastLoginTime($lastLoginTime)
    {
        $this->lastLoginTime = $lastLoginTime;

        return $this;
    }

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

    /**
     * Set loginTime
     *
     * @param \DateTime $loginTime
     * @return VtigerPortalinfo
     */
    public function setLoginTime($loginTime)
    {
        $this->loginTime = $loginTime;

        return $this;
    }

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

    /**
     * Set logoutTime
     *
     * @param \DateTime $logoutTime
     * @return VtigerPortalinfo
     */
    public function setLogoutTime($logoutTime)
    {
        $this->logoutTime = $logoutTime;

        return $this;
    }

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

    /**
     * Set isactive
     *
     * @param integer $isactive
     * @return VtigerPortalinfo
     */
    public function setIsactive($isactive)
    {
        $this->isactive = $isactive;

        return $this;
    }

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

    /**
     * Set id
     *
     * @param \WbsGo\clientsBundle\Entity\VtigerContactdetails $id
     * @return VtigerPortalinfo
     */
    public function setId(\WbsGo\clientsBundle\Entity\VtigerContactdetails $id = null)
    {
        $this->id = $id;

        return $this;
    }

    /**
     * Get id
     *
     * @return \WbsGo\clientsBundle\Entity\VtigerContactdetails 
     */
    public function getId()
    {
        return $this->id;
    }
}
4

1 回答 1

1

也许如果您更改此行的 $id 注释行:

*ORM\GeneratedValue(strategy="IDENTITY")
于 2013-07-29T23:05:57.310 回答