symfony2 doctrine2中var_dump的数据过多 [英] Too much data with var_dump in symfony2 doctrine2

查看:137
本文介绍了symfony2 doctrine2中var_dump的数据过多的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有大约40个实体和许多双向关系。
每当我使用var_dump($ user)或任何实体,我的浏览器都会加载太多的数组和变量数据,那么它就会崩溃。



我想有什么问题。



正在插入数据。我可以在生产中造成问题。

解决方案

使用调试方法替换 var_dump()由Doctrine Common提供的转储()

  \Doctrine\Common\Util\Debug :: dump($ user); 

它适用于单个对象和Doctrine集合,并应阻止浏览器显示您遇到的问题。 >

I have around 40 entities and many bidirectional relationships. Whenever i use var_dump($user) or any entity my browser gets loaded with too much data of arrays and variables then it just crashed.

i want to whats the problem.

The data is being inserted fine. Can i cause issue in production.

解决方案

Replace var_dump() with the debug method dump() provided by Doctrine Common.

\Doctrine\Common\Util\Debug::dump($user);

It works for single objects and Doctrine collections and should prevent browser displaying issues you are having.

这篇关于symfony2 doctrine2中var_dump的数据过多的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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