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

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

问题描述

我随身携带 Symfony2文档。这就是说,添加

I go with Symfony2 docs. It's said that adding

/**
 * @ORM\Entity(repositoryClass="Acme\StoreBundle\Entity\ProductRepository")
 */

在我的实体文件中运行 php app / console doctrine: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映射之前已经生成了实体类,那么您必须自己创建该类。幸运的是,这很简单。只需在bundle的Repository目录中创建类,并确保它扩展了Doctrine\ORM\EntityRepository。创建课程后,您可以添加任何方法来查询您的实体。

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 Doctrine\ORM\EntityRepository. 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 doctrine:generate:实体不生成repo类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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