Symfony2s 学说:生成:实体不生成 repo 类 [英] Symfony2s doctrine:generate:entities doesn't generate repo classes

查看:19
本文介绍了Symfony2s 学说:生成:实体不生成 repo 类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Symfony2 文档.据说加了

/**
 * @ORMEntity(repositoryClass="AcmeStoreBundleEntityProductRepository")
 */

在我的实体文件中并运行 php app/console dictionary:generate:entities Acme 应该会创建 ProductRepository 文件.它没有.我不能再澄清了,它只是不创建那个文件,只是重新创建以前存在的那些实体文件.

in my entity file and running php app/console doctrine:generate:entities Acme should create the ProductRepository file. It doesn't. I can't clarimy this more, it's just doesnt create that file, just recreates those entity files that were there before.

推荐答案

我也遇到了同样的问题

但我在这里找到了答案:http://brentertainment.com/other/docs/book/doctrine/orm.html

But I've found the answer here: http://brentertainment.com/other/docs/book/doctrine/orm.html

如果您在添加 repositoryClass 映射之前已经生成了实体类,则必须自己创建类.幸运的是,这很容易.只需在包的 Repository 目录中创建类,并确保它扩展了 DoctrineORMEntityRepository.创建类后,您可以添加任何方法来查询您的实体.

If you have already generated your entity class before adding the repositoryClass mapping, you have to create the class on your own. Fortunately, it’s pretty easy. Simply create the class in the Repository directory of your bundle and be sure it extends DoctrineORMEntityRepository. Once you’ve created the class, you can add any method to query your entities.

很简单,我们必须手动完成,因为我们已经运行过一次了

Simple, we have to do it by hand because we have already run this once

这篇关于Symfony2s 学说:生成:实体不生成 repo 类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆