gpt4 book ai didi

symfony - 命名空间 "..."不包含任何映射实体

转载 作者:行者123 更新时间:2023-12-02 21:43:15 25 4
gpt4 key购买 nike

当我尝试从控制台创建实体时,出现以下错误:

命名空间“...”不包含任何映射实体

所以,

这是我的代码

哪里错了,请告诉我。谢谢。

                namespace SfTuts\JobeetBundle\Entity;
use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Entity
* @ORM\Table(name="job")
*/
class Job
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
protected $id;

/**
* @ORM\ManyToOne(targetEntity="Category")
* @ORM\JoinColumn(name="category_id", referencedColumnName="id")
*/
protected $category;

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

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

/**
* @ORM\Column(type="string", length=255)
*/
protected $logo;

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

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

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

/**
* @ORM\Column(type="string", length=4000)
*/
protected $description;

/**
* @ORM\Column(type="string", length=4000, name="how_to_apply")
*/
protected $howToApply;

/**
* @ORM\Column(type="string", length=255, unique=true)
*/
protected $token;

/**
* @ORM\Column(type="boolean", name="is_public")
*/
protected $isPublic;

/**
* @ORM\Column(type="boolean", name="is_activated")
*/
protected $isActivated;

/**
* @ORM\Column(type="string", length=255)
*/
protected $email;

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

/**
* @ORM\Column(type="datetime", name="updated_at")
*/
protected $updatedAt;

/**
* @ORM\Column(type="datetime", name="expires_at")
*/
protected $expiresAt;

public function __construct()
{
$this->createdAt = new \DateTime();
$this->updatedAt = new \DateTime();
}
}

我该如何解决这个问题。谢谢。

最佳答案

使用

doctrine:generate:entity

创建一个新实体。

然后通过编辑文件添加您自己的属性后,使用

doctrine:generate:entities AcmeDemoBundle:MyEntity

创建 getter/setter

关于symfony - 命名空间 "..."不包含任何映射实体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20034767/

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