无效的实体或超级基类

问题描述 投票:0回答:1

我使用过Symfony 2,我已经成功配置了FOSUserBundle。

我的应用程序在生产和开发模式下在Windows机器上正常工作

但是当我在Linux机器上部署它时,它在开发模式下工作正常,但它在生产模式下提供了一个空白页面。当我检查错误日志文件时,它有以下错误:

request.CRITICAL: Doctrine\ORM\Mapping\MappingException: Class \Entity\User is not a  
valid entity or mapped super class. (uncaught exception)

request.CRITICAL: Exception thrown when handling an exception 
(Doctrine\ORM\Mapping\MappingException: Class \Entity\User is not a valid entity or 
mapped super class.) [] []

看看我的User Entity类:

/**
 * @ORM\Entity(repositoryClass="\Repository\UserRepository")
 * @ORM\Table(name="user")
 */
class User extends BaseUser
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @ORM\Column(type="string", length="255")
     *
     * @Assert\NotBlank(message="Please enter your name.", groups={"Registration",     "Profile"})
     * @Assert\MinLength(limit="3", message="The name is too short.", groups={"Registration", "Profile"})
     * @Assert\MaxLength(limit="255", message="The name is too long.", groups={"Registration", "Profile"})
     */
    protected $name;

    /**
     * @ORM\Column(type="date", length="255", nullable=true)
     *
     * @Assert\NotBlank(message="Please select your Date Of Birth.", groups={"Registration", "Profile"})
     */
    protected $dob;

    /**
     * @ORM\Column(type="string", length="255")
     *
     * @Assert\NotBlank(message="Please select your Date Of Birth.", groups={"Registration", "Profile"})
     */
    protected $gender;

    /**
     * Override $email so that we can apply custom validation.
     * 
     * @Assert\Email(groups={"AppRegistration"})
     */
    protected $email;

    /**
     * @var string $firstName
     *
     * @ORM\Column(name="first_name", type="string", length=20, nullable=true)
     */

    protected $firstName;

    /**
     * @var string $lastName
     *
     * @ORM\Column(name="last_name", type="string", length=20, nullable=true)
     */
    protected $lastName;

/**
     * @var datetime $createdAt
     *
     * @ORM\Column(name="created_at", type="datetime", nullable=true)
     */
    protected $createdAt;

    /**
     * @ORM\Column(type="string", length="255", nullable=true)
     * @var string
     */
    protected $facebookID;


    /** 
     * @ORM\Column(type="string", length="255", nullable=true)
     * @var string
     */
    protected $twitterID;

    /** 
     * @ORM\Column(type="string", length="255", nullable=true)
     * @var string
     */
    protected $twitter_username;

    /** 
     * @ORM\Column(type="string", length="255", nullable=true)
     * @var string
     */
    protected $image_path;

    /** 
     * @ORM\Column(name="home_town",type="string", length="255", nullable=true)
     * @var string
     */
    protected $homeTown;

    /** 
     * @ORM\Column(name="location",type="string", length="255", nullable=true)
     * @var string
     */
    protected $location;

    /** 
     * @ORM\Column(name="interest",type="string", length="255", nullable=true)
     * @var string
     */
    protected $interest;

    /** 
     * @ORM\Column(name="friend",type="string", length="255", nullable=true)
     * @var string
     */
    protected $friend;

/**
     * @var smallint $age
     *
     * @ORM\Column(name="age", type="smallint", nullable=true)
     */
    protected $age;

    /**
     * @var string $country
     * @ORM\ManyToOne(targetEntity="Country", inversedBy="user")
     * @ORM\JoinColumn(name="country_id", referencedColumnName="id")
     * @ORM\Column(name="country_id", type="string", length=25, nullable=true)
     */
    protected $countryId;

    /**
     * @ORM\OneToMany(targetEntity="ProfileViewer", mappedBy="viewer")
     */
    protected $viewers;

    ..................
symfony fosuserbundle
1个回答
1
投票

我认为您需要将名为User的实体更改为任何其他名称,例如Users

因为User是数据库中的保留关键字。更改此设置并再次构建架构。可能这是错误吗?

© www.soinside.com 2019 - 2024. All rights reserved.