Yii Framework Forum: Yii:die() , Yii:varDump() - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Yii:die() , Yii:varDump() Rate Topic: -----

#1 User is offline   notzippy 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 201
  • Joined: 06-October 08

Posted 15 October 2008 - 09:33 AM

2 quickies

Yii:die() - In a view since the output is buffered if you try to debug something with a die() you get an empty screen, is it possible to add a Yii::die function that does something like
echo ob_get_contents();
die($param);

Yii:varDump - Loved prado varDump , can this be added into the Yii framework ?

Thanks
NZ
0

#2 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,899
  • Joined: 04-October 08
  • Location:DC, USA

Posted 15 October 2008 - 09:44 AM

You can use Yii::app()->end().
However, I think even if the output is buffered, calling die() should still display the buffered content.

Please create a ticket for varDump. Will add it.
0

#3 User is offline   notzippy 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 201
  • Joined: 06-October 08

Posted 15 October 2008 - 10:50 AM

Thanks,
Ticket added for varDump.

I had encountered issues with the output not appearing in different frameworks that used a similar buffering technique. But your right it appears to work fine right now. On this page http://ca.php.net/ref.outcontrol there is a comment on the issue that suggested ob_end_flush() is the default call.

NZ
0

#4 User is offline   ShabbyRobe 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 42
  • Joined: 13-October 08

Posted 16 October 2008 - 10:03 PM

As Yii::varDump() is usually only needed for print_r debugging, would it make sense to put it in something like a CDebugUtility class which isn't loaded into memory by default, and chuck something in the autoload function?
0

#5 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,899
  • Joined: 04-October 08
  • Location:DC, USA

Posted 16 October 2008 - 10:08 PM

All framework classes are loaded on demand. So there is no waste here.
0

#6 User is offline   ShabbyRobe 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 42
  • Joined: 13-October 08

Posted 16 October 2008 - 10:11 PM

It would be loaded into memory all the time if it was a part of YiiBase though, that's why I was suggesting something like CDebugUtility. I'm looking at the autoload and import stuff at the moment - it's quite nice.
0

#7 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,899
  • Joined: 04-October 08
  • Location:DC, USA

Posted 16 October 2008 - 10:30 PM

Not really. (This is true for Prado, but not for Yii).
When you call import() in Yii, it doesn't include the file immediately. The file will only be included when needed.
0

#8 User is offline   ShabbyRobe 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 42
  • Joined: 13-October 08

Posted 16 October 2008 - 10:48 PM

Yep, I follow you there. All i'm really suggesting is that varDump not be added to YiiBase because YiiBase is *always* included. If the varDump method is added to YiiBase (like in PradoBase), then it will also always be included. I just think it should be in a separate class so it can take advantage of the load on demand functionality you mention.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users