Since I always forget, here is a quick reference for throwing exceptions and adding log/debug messages throughout your symfony project.
Exceptions
This is how you can throw a new symfony exception.
throw new sfException('An error occurred. Please go back and try again.');
Logging
Within an action, this is how you can log a message:
<?php use_helper('Debug') ?>
<?php if ($problem): ?>
<?php echo log_message('{mainActions} been there', 'err') ?>
<?php endif ?>
And elsewhere within the code (model, etc):
sfContext::getInstance()->getLogger()->info($message);
sfContext::getInstance()->getLogger()->err($message);
Debugging
// in an action
$this->debugMessage($message);
// in a template
<?php echo debug_message($message) ?>
Reference: Symfony Docs: Debugging


