简体   繁体   English

在Symfony2中使用Doctrine dump工具时获取双数组

[英]Getting double array when using Doctrine dump utility with Symfony2

Im getting a double print value when using Doctrine dump utility like: 我在使用Doctrine转储实用程序时获得双重打印值:

exit(\Doctrine\Common\Util\Debug::dump($array));

exit(\Doctrine\Common\Util\Debug::dump("Hello World"));

This is an example of what Im getting when using it: 这是Im使用时得到的示例:

string(10) "hola mundo" string(10) "hola mundo"

Or for an array, would be this 或者对于数组,这是

array(3) {
  [1]=>
  string(3) "RED"
  [2]=>
  string(5) "GREEN"
  [3]=>
  string(4) "BLUE"
}
array(3) {
  [1]=>
  string(3) "RED"
  [2]=>
  string(5) "GREEN"
  [3]=>
  string(4) "BLUE"
}

This is happening to me in every controller Im using. 我正在使用的每个控制器中都发生这种情况。 Apart from this, everything works well but I have other projects and this isnt working like this. 除此之外,一切都运行良好,但是我还有其他项目,而这种工作方式并非如此。 Im using 2.6.11 version of sf. 我正在使用SF的2.6.11版本。

Any idea how to solve this behavior? 任何想法如何解决此问题?

Thanks in advanced. 提前致谢。

For further reference: 进一步参考:

Function dump() defined in Doctrine\\Common\\Util\\Debug.php looks as fallow: 在Doctrine \\ Common \\ Util \\ Debug.php中定义的函数dump()看起来是休闲的:

public static function dump($var, $maxDepth = 2, $stripTags = true, $echo = true) {
...
}

You can call it like this dump($your_variable, 2, true, false) and you should get single result, basically you just have to override default parameters. 您可以像这样的转储来调用它($ your_variable,2,true,false),并且应该得到单个结果,基本上,您只需要覆盖默认参数即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM