簡體   English   中英

Symfony doctrine 錯誤“DoctrineMigrationsBundle 需要啟用 DoctrineBundle。”

[英]Symfony doctrine error "DoctrineMigrationsBundle requires DoctrineBundle to be enabled."

我創建了一個新的 Symfony 項目,並且不斷收到此消息“DoctrineMigrationsBundle 需要啟用 DoctrineBundle”。 錯誤,無法擺脫它。 顯然我是 pl.net 上唯一一個得到這個錯誤的人,因為谷歌不是很有幫助。

在 config/bundles.php 文件中我有以下應該“啟用”DoctrineBundle 但我遺漏了一些東西並且無法告訴它是什么。

return [
    Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
    Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
    Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
];

我有同樣的錯誤,出於某種原因,應該在config/packages中的 yaml 文件沒有提交給 git。

您可以執行以下操作:

  • 創建一個新的 symfony 項目
  • 將 config/packages 文件夾從全新安裝復制到我的項目
  • 如果/bin文件夾也丟失,也復制它
  • 將這兩行添加到.gitignore
    !/bin/
    !/config/packages/*

文件樹包括配置/包

(將!/bin添加到.gitignore與此錯誤無關,但自 symfony 6 起不應再忽略它,並且是修復此其他錯誤的解決方案: Script cache:clear returned with error code 1
Could not open input file: ./bin/console). 當您從 git 安裝 symfony 項目時。

通過將 !/bin 添加到 .gitignore 來解決錯誤

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM