propelorm/Propel — pull request #419 by grray (2012-07-17 14:25:58+00:00)
Title: doSave() method needs exception handling for having correct value of property alreadyInSave

Typical generated doSave method looks like this:
```php
protected function doSave(PropelPDO $con)
{
$affectedRows = 0; // initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;

if ($this->isNew() || $this->isModified()) {
// persist changes
if ($this->isNew()) {
$this->doInsert($con);
} else {
$this->doUpdate($con);
}
$affectedRows += 1;
$this->resetModified();
}

$this->alreadyInSave = false;

}

return $affectedRows;
} // doSave()
```

When exception occurs in doInsert or doUpdate, alreadyInSave property will not be set to false, and later $obj->save() calls silently will not save object to DB. This patch fixing it by handling exception like this:
```php
protected function doSave(PropelPDO $con)
{
$affectedRows = 0; // initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;

try {

if ($this->isNew() || $this->isModified()) {
// persist changes
if ($this->isNew()) {
$this->doInsert($con);
} else {
$this->doUpdate($con);
}
$affectedRows += 1;
$this->resetModified();
}

$this->alreadyInSave = false;

} catch (Exception $e) {
$this->alreadyInSave = false;
throw $e;
}

}

return $affectedRows;
} // doSave()
```