Symfony 2中的2级实体文件夹 [英] 2 Level Entity Folder in Symfony 2

查看:82
本文介绍了Symfony 2中的2级实体文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Symfony2包中有一个两级实体文件夹:

  CommonBundle / Entity / EntityFolder1 / EntityA.php 
CommonBundle / Entity / EntityFolder2
CommonBundle / Entity / EntityFolder3
CommonBundle / Entity / EntityFolder4

当我尝试获取位于其中一个文件夹中的实体的存储库时:

  $ product = $ this-> getDoctrine() - > getRepository('CommonBundle:EntityA') - > find(1); 

Symfony无法识别这个 CommonBundle:EntityA



我还尝试使用 CommonBundle:EntityFolder1:EntityA


警告:class_parents():Class CommonBundle\Entity\EntityA不存在
,无法加载到



解决方案

它是 CommonBundle:EntityFolder1\EntityA


I have a two level entity folder in a Symfony2 bundle:

CommonBundle/Entity/EntityFolder1/EntityA.php
CommonBundle/Entity/EntityFolder2
CommonBundle/Entity/EntityFolder3
CommonBundle/Entity/EntityFolder4

When I try to get the repositories for an entity that is within one of the folders:

$product = $this->getDoctrine()->getRepository('CommonBundle:EntityA')->find(1); 

Symfony doesn't recognize this CommonBundle:EntityA.

I also tried with CommonBundle:EntityFolder1:EntityA.

Warning: class_parents(): Class CommonBundle\Entity\EntityA does not exist and could not be loaded in

解决方案

It's CommonBundle:EntityFolder1\EntityA.

这篇关于Symfony 2中的2级实体文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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