public function save(Doctrine_Connection $conn = null) { // we don't handle this save when we load data from command line if (!isset($_SERVER['REQUEST_URI'])) { return parent::save($conn); } if (!$conn) { $conn = Doctrine_Manager::connection(); } try { $conn->beginTransaction(); $topic = $this->getsfSimpleForumTopic(); if ($this->isNew()) { $topic->clearViews(); } parent::save($conn); $latestPost = $topic->getLatestPostByQuery(); if (isset($preserveTopic)) { $topic->leaveUpdatedAtUnchanged(); } $topic->updateReplies($latestPost, $conn); $conn->commit(); } catch (Exception $e) { $conn->rollback(); throw $e; } }
public function save($con = null, $preserveTopic = false) { if (!$con) { $con = Propel::getConnection(); } try { $con->begin(); $topic = $this->getsfSimpleForumTopic(); if ($this->isNew()) { $topic->clearViews(); } parent::save($con); $latestPost = $topic->getLatestPostByQuery(); if ($preserveTopic) { $topic->leaveUpdatedAtUnchanged(); } $topic->updateReplies($latestPost, $con); $con->commit(); } catch (Exception $e) { $con->rollback(); throw $e; } }