本文介绍了Symfony:为什么isInitialized总是错误的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用学说来查询用户:

I used doctrine query a user:

$customer = $this->getDoctrine()->getRepository('DemoUserBundle:Customer')->find(1);

但是我得到了结果:

结果未完成,该用户的其他数据在哪里?为什么isInitialized为false?

the result is not completed, where are other data of this user? why the isInitialized is false?

推荐答案

我添加了 fetch = EAGER

I added fetch="EAGER" to an other entity which called this entity and it is Ok for me.

尝试 $ customer = $ this-> getDoctrine()- > getRepository('DemoUserBundle:Customer')-> find(1);

$ customer = $ this-> getDoctrine()-> getRepository('DemoUserBundle:Customer')-> find(2);

您会明白的。

这篇关于Symfony:为什么isInitialized总是错误的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-09 14:42