Example #1
0
 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;
 }
Example #2
0
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->create_time = $this->update_time = time();
         $this->user_id = Yii::app()->user->id;
     } else {
         $this->update_time = time();
     }
     return parent::beforeSave();
 }
Example #3
0
File: News.php Project: kotow/work
 public function delete($con = null)
 {
     try {
         $con = Propel::getConnection();
         $con->begin();
         Document::getGenericDocument($this)->delete();
         parent::delete();
         $con->commit();
         Document::deleteObjCache($this);
         return true;
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }
Example #4
0
 public function getPeer()
 {
     if (self::$peer === null) {
         self::$peer = new NewsPeer();
     }
     return self::$peer;
 }
Example #5
0
 public function init()
 {
     return parent::init();
 }