class yourActions extends sfActions
/**
other code...
**/
/**
* Just a neater way of dumping objects to the log file instead of the browser
*
* @param $foobar
* @param $priority
* @author Richard Udovich
* @return void
* @see self::logMessage()
*/
public function logFoobar($foobar, $priority = 'info') {
if (in_array('Doctrine_Record', class_parents($foobar))) {
$table_name = $foobar->getTable()->getClassnameToReturn();
$this->logMessage('Dumping '.$table_name. "\n".print_r($foobar->toArray(), true).')', 'debug');
}
}
Friday, May 28, 2010
No more print_r's or var_dumps to the web browser
Here is a neat way to dump objects to the log file instead of the browser, just add the following function to your actions class
Labels:
doctrine,
Doctrine_Record,
doctrine1.2,
log,
symfony,
symfony1.4
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment