亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

符號 cmd 錯誤“目標實體..在中找不到..”

符號 cmd 錯誤“目標實體..在中找不到..”

PHP
慕碼人2483693 2022-09-25 20:18:51
我從辛福尼框架開始,我正在努力建立許多人的關系。但是當我嘗試這個命令行時php bin/console doctrine:schema:update我收到此錯誤:The target-entity C:\xampp\htdocs\symfony-tp\src\Entity\Competetence cannot be found in 'App\Entity\Stagiaire#competencies'.斯塔吉耶爾.php<?phpnamespace App\Entity;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass="App\Repository\StagiaireRepository") */class Stagiaire{    /**     * @ORM\ManyToMany(targetEntity="C:\xampp\htdocs\symfony-tp\src\Entity\Competetence",cascade={"persist"})     */    private $competencies;    /**     * @ORM\Id()     * @ORM\GeneratedValue()     * @ORM\Column(type="integer")     */    private $id;    /**     * @ORM\Column(type="datetime")     */    private $createdAt;    /**     * @ORM\Column(type="string", length=50)     */    private $name;    /**     * @ORM\Column(type="integer")     */    private $phone;    /**     * @ORM\Column(type="datetime")     */    private $birthday;    /**     * @var \Datetime     */    private $date;    public function __construct()    {        $this->date = new \Datetime();        $this->competencies = new ArrayCollection();    }    public function addCompetence(Competence $competence)    {        $this->$competence[] = $competence;        return $this;    }    public function removeCompetence(Competence $competence)    {        $this->competencies->removeElement($competence);    }    public function getCompetencies()    {        return $this->competencies;    }    public function getId(): ?int    {        return $this->id;    }    public function getCreatedAt(): ?\DateTimeInterface    {        return $this->createdAt;    }    public function setCreatedAt(\DateTimeInterface $createdAt): self    {        $this->createdAt = $createdAt;        return $this;    }    public function getName(): ?string    {        return $this->name;    }    public function setName(string $name): self    {        $this->name = $name;        return $this;    }
查看完整描述

1 回答

?
一只名叫tom的貓

TA貢獻1906條經驗 獲得超3個贊

在注釋中,您需要提供 的完全限定類名,而不是計算機上的文件路徑,這將是Stagiaire::$competenciesCompetenceApp\Entity\Competence

所以這個:

    /**
     * @ORM\ManyToMany(targetEntity="C:\xampp\htdocs\symfony-tp\src\Entity\Competetence",cascade={"persist"})
     */
    private $competencies;

成為:

    /**
     * @ORM\ManyToMany(targetEntity="App\Entity\Competence",cascade={"persist"})
     */
    private $competencies;


查看完整回答
反對 回復 2022-09-25
  • 1 回答
  • 0 關注
  • 86 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號