2014-01-21 41 views
1

映射規則只能使用註釋我想要學說只使用現有的實體類(不YAML)內的註釋。定義學說

當我執行:php app/console doctrine:schema:update,我得到錯誤信息:

Invalid mapping file 'TEST.Bundle.BlogBundle.Entity.Image.orm.yml' for clas 
s 'TEST\Bundle\BlogBundle\Entity\Image'. 

文件TEST.Bundle.BlogBundle.Entity.Image.orm.yml是空的。這個錯誤背後的原因是什麼?

我怎麼能告訴學說考慮到由註釋指定的元數據?

非常感謝。

+1

你使用哪種版本的PHP? –

+0

謝謝@Victor。 –

回答

3

刪除文件:

TEST.Bundle.BlogBundle.Entity.Image.orm.yml 

注:基於Symfony2的文檔

"A bundle can accept only one metadata definition format. For example, 
it's not possible to mix YAML metadata definitions with annotated PHP 
entity class definitions." 
+0

使用您的答案後,問題就解決了。不過,我想問一個問題。我可以在同一個項目下使用YAML來處理一些實體和其他人的註釋嗎?如果兩者都用於實體,YAML總是優先嗎? –

+0

其實,我在我的瀏覽器下找到'沒有映射文件找到命名錯誤。我想我需要在配置中指定我應該使用該特定實體的註釋併爲其他人保留YAML。對? –

+0

@whitelettersandblankspaces我不太確切,在你的案例中看到yaml更優先。 –