gpt4 book ai didi

symfony - Class ..Entity\User 不是有效的实体或映射的父类(super class)

转载 作者:行者123 更新时间:2023-12-04 16:26:20 25 4
gpt4 key购买 nike

当我尝试清除缓存时出现此错误(例如):

[Doctrine\ORM\Mapping \MappingException] Class Aib\PlatformBundle\Entity\User is not a valid entity or mapped super class.



这是 User.php:
<?php
// src/Aib/PlatformBundle/Entity/User.php

namespace Aib\PlatformBundle\Entity;

use FOS\UserBundle\Entity\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;

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

public function __construct()
{
parent::__construct();
// your own logic
}

}

这是存储 User.php 的地方:

javier@javier:~/programacion/aib/src/Aib/PlatformBundle/Entity$ ls User.php UserRepository.php



这是 AppKernel.php:
public function registerBundles()
{
$bundles = array(
...
new Aib\PlatformBundle\AibPlatformBundle(),
...
);

SF 2.0.4

最佳答案

就我而言,我失踪了 * @ORM\Entity在我的类(class)定义中。

/**
* @ORM\Entity
* @ORM\Table(name="listtype")
*/
class ListType
{
...
}

关于symfony - Class ..Entity\User 不是有效的实体或映射的父类(super class),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7995386/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com