public function save(Doctrine_Connection $con = null) { $id = $this->getId(); $q = parent::save(); if (!$id) { Doctrine::getTable("Shoutbox")->setShout(array("postedNewNews", "newspaper_add.png", $this->getTitle()), sfContext::getInstance()->getController()->genUrl("@news?slug=" . $this->getSlug())); } return $q; }
public function save($con = null, $parent = null) { try { $con = Propel::getConnection(); $con->begin(); if (!$this->getId()) { $this->setId(Document::getGenericDocument($this)->getId()); } parent::save($con); // create relationship if (!$parent && !Document::getParentOf($this->getId())) { $parent = Rootfolder::getRootfolder($this); } Relation::saveRelation($parent, $this); $con->commit(); Document::cacheObj($this, get_class($this)); return true; } catch (Exception $e) { $con->rollback(); throw $e; } }