Debbugging symfony / ullright
Get trace stack
When using the web interface or unit tests (and assuming using xDebug) it is sufficent to insert a "trigger_error()" statement at the desired position in the code.
When using functional tests the method described above does not work. Therefore we have to fall back to "debug_backtrace()" which delivers the current trace stack.
There is one serious problem though: Very often Doctrine_Record objects are used as arguments. It's common knowledge, that they cannot be outputted using var_dump or silmilar because of circular references.
The solution is to use our ullCoreTools::debugArrayWithDoctrineRecords() method.
Example:
var_dump(ullCoreTools::debugArrayWithDoctrineRecords(debug_backtrace()));
Logging
The symfony logging mechanism comes very handy in case of debugging functional tests, because sometimes a var_dump() output or similar does not come through to the shell output.
Usage:
sfContext::getInstance()->getLogger()->alert('my_message');
Logger settings: http://www.symfony-project.org/reference/1_4/en/05-Factories#chapter_05_logger