擺脫這個問題,併產生回購類,可以臨時修改下列文件的末尾: 的symfony \供應商\主義\學說束\原則\包\ DoctrineBundle \ COMMAND \ generateEntitiesDoctrineCommand。 PHP
if ($m->customRepositoryClassName
&& false !== strpos($m->customRepositoryClassName, $metadata->getNamespace())) {
$repoGenerator->writeEntityRepositoryClass(
$m->customRepositoryClassName, $metadata->getPath());
}
用下面的代碼:
if (true) {
$output->writeln(
sprintf(' > AND Repository <comment>%s</comment>', $m->name . "Repository")
);
$repoGenerator->writeEntityRepositoryClass(
$m->name . "Repository", $metadata->getPath());
}
幾點說明:在此代碼,
- 的如果條件得到簡化與 '如果(真)'(和終於可以,如果你想完全抑制)
- $ M-> customRepositoryClassName由$更換名稱。「庫」
- 我添加了一些輸出,以便在生成回購文件時得到充分的信息(在終端窗口中)。
如果不使用「如果(真)」狀態,想自己來檢查的事情,你也可以與輸出加到兼其他情況下得到消息靈通在未來:
else {
$output->writeln(sprintf(' > NO repository generated for this class'));
}
修改後,您可以重新運行該命令照常:
php app/console doctrine:generate:entities AcmeStoreBundle
這是一個臨時的代碼,因爲這個問題是不是對我來說很清楚到現在爲止,唯一的事情,我SE e是它似乎來自$ m-> customRepositoryClassName,它返回一個空字符串。 因此,要找到另一個和明確的解決辦法,一個辦法可能是檢查的元數據對象的方法customRepositoryClassName ...
你是如何檢查文件不存在?如果它位於IDE中,請嘗試刷新。該命令沒有說明有關生成Repository文件的任何信息,但無論如何都會生成它們。 – smottt
無論是在IDE和通過Windows的資源管理器。 –