Flashing temporary values
Sometimes it is necessary to set a temporary variable for one request, or make a variable available to another action after forwarding but before having to delete the variable. Symfony provides this level of functionality within the sfUser object known as a flash variable. Once a flash variable has been set, it lasts until the end of the overall request before it is automatically destroyed.
Setting and getting a flash attribute is managed through two of the sfUser methods. Also, you can test for a flash variable's existence using the third method of the methods listed here:
$this->getUser()->setFlash($name, $value, $persist = true)$this->getUser()->getFlash($name)$this->getUser()->hasFlash($name)
Although a flash variable will be available by default when a request is forwarded to another action, setting the argument to false will delete the flash variable before it is forwarded.
To demonstrate how useful flash variables can be, let's readdress...