Ejemplo n.º 1
0
 public function save(Doctrine_Connection $conn = null)
 {
     if (!$this->exists()) {
         $this->setCreatedAt(date('Y-m-d H:i:s'));
     }
     $this->setUpdatedAt(date('Y-m-d H:i:s'));
     parent::save($conn);
 }
Ejemplo n.º 2
0
 public function save($con = null)
 {
     $highlighted = myUtils::highlight($this->getRawBody());
     $this->setBody($highlighted['body']);
     $summarizer = new Summarizer(200);
     $this->setSummary($summarizer->summarize($this->getBody()));
     parent::save();
 }
Ejemplo n.º 3
0
 public function setTableDefinition()
 {
     // Add all the Commentable relations
     foreach ($this->getCommentables() as $class) {
         $this->hasMany($class, array('refClass' => $class . 'Comment', 'local' => 'comment_id', 'foreign' => 'id'));
         $this->hasOne($class . 'Comment', array('local' => 'id', 'foreign' => 'comment_id'));
     }
     return parent::setTableDefinition();
 }
Ejemplo n.º 4
0
 /**
  * Delete comment
  *
  * @param void
  * @return null
  */
 function delete()
 {
     $deleted = parent::delete();
     if ($deleted) {
         $object = $this->getObject();
         if ($object instanceof ProjectDataObject) {
             $object->onDeleteComment($this);
         }
         // if
     }
     // if
     return $deleted;
 }
Ejemplo n.º 5
0
 /**
  * Returns a peer instance associated with this om.
  *
  * Since Peer classes are not to have any instance attributes, this method returns the
  * same instance for all member of this class. The method could therefore
  * be static, but this would prevent one from overriding the behavior.
  *
  * @return     CommentPeer
  */
 public function getPeer()
 {
     if (self::$peer === null) {
         self::$peer = new CommentPeer();
     }
     return self::$peer;
 }
Ejemplo n.º 6
0
 public function delete(Doctrine_Connection $conn = null)
 {
     LuceneEngine::deleteLuceneIndexFor($this);
     return parent::delete($conn);
 }
 public static function model($className = __CLASS__)
 {
     return parent::model($className);
 }
Ejemplo n.º 8
0
 public function setUp()
 {
     $this->hasOne('sfGuardUser as User', array('local' => 'user_id', 'foreign' => 'id'));
     BaseComment::setUp();
 }