Exemplo n.º 1
0
Arquivo: Post.php Projeto: rayku/rayku
 /**
  * Updates the lastpost_at field in this post's Thread and saves the post
  */
 public function save(PropelPDO $con = null)
 {
     //Set the ID and lastpost_at to the right values
     $c = new Criteria();
     $c->add(ThreadPeer::ID, $this->getThreadId());
     $c->add(ThreadPeer::LASTPOST_AT, time());
     //Update the thread table
     ThreadPeer::doUpdate($c);
     $new = $this->isNew();
     $ret = parent::save($con);
     if ($new) {
         HistoryPeer::createFor($this);
     }
     return $ret;
 }
Exemplo n.º 2
0
 public static function model($className = __CLASS__)
 {
     return parent::model($className);
 }
Exemplo n.º 3
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     PostPeer
  */
 public function getPeer()
 {
     if (self::$peer === null) {
         self::$peer = new PostPeer();
     }
     return self::$peer;
 }
Exemplo n.º 4
0
 public function setCreatedAt($v)
 {
     parent::setCreatedAt($v);
     $this->setYear(date('Y', $this->getCreatedAt(null)));
     $this->setMonth(date('n', $this->getCreatedAt(null)));
 }
 /**
  * @dataProvider get_post_type_label_provider
  */
 public function test_get_post_type_label($expected_value, array $post_type_def, $label)
 {
     register_post_type('test-post-type', $post_type_def);
     $post_id = $this->factory->post->create(array('post_type' => 'test-post-type'));
     $post_obj = new BasePost($post_id);
     $this->assertEquals($expected_value, $post_obj->get_post_type_label($label));
 }