public function save(Doctrine_Connection $con = null, $latestPost = null) { // we don't handle this save when we load data from command line if (!isset($_SERVER['REQUEST_URI'])) { return parent::save($con); } if (!$con) { $con = Doctrine_Manager::connection(); } try { $con->beginTransaction(); parent::save($con); // Update the topic's forum counts $forum = $this->getsfSimpleForumForum(); if (!$latestPost) { $latestPost = $forum->getLatestPostByQuery(); } $forum->updateCounts($latestPost, $con); $con->commit(); } catch (Exception $e) { $con->rollback(); throw $e; } }
public function save($con = null, $latestPost = null) { if (!$con) { $con = Propel::getConnection(); } try { $con->begin(); parent::save($con); // Update the topic's forum counts $forum = $this->getsfSimpleForumForum(); if (!$latestPost) { $latestPost = $forum->getLatestPostByQuery(); } $forum->updateCounts($latestPost, $con); $con->commit(); } catch (Exception $e) { $con->rollback(); throw $e; } }