我使用过 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.) [] []
看看我的用户实体类:
/**
* @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;
..................