public function getPositionInTopic()
 {
     $c = new Criteria();
     $c->clearSelectColumns();
     $c->addSelectColumn(sfSimpleForumPostPeer::ID);
     $c->add(sfSimpleForumPostPeer::TOPIC_ID, $this->getTopicId());
     $c->addAscendingOrderByColumn(sfSimpleForumPostPeer::CREATED_AT);
     $rs = sfSimpleForumPostPeer::doSelectRS($c);
     $messages = array();
     while ($rs->next()) {
         $messages[] = $rs->getInt(1);
     }
     return array_search($this->getId(), $messages);
 }
 public static function doCountJoinAllExceptsfSimpleForumForum(Criteria $criteria, $distinct = false, $con = null)
 {
     $criteria = clone $criteria;
     $criteria->clearSelectColumns()->clearOrderByColumns();
     if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
         $criteria->addSelectColumn(sfSimpleForumPostPeer::COUNT_DISTINCT);
     } else {
         $criteria->addSelectColumn(sfSimpleForumPostPeer::COUNT);
     }
     foreach ($criteria->getGroupByColumns() as $column) {
         $criteria->addSelectColumn($column);
     }
     $criteria->addJoin(sfSimpleForumPostPeer::TOPIC_ID, sfSimpleForumTopicPeer::ID);
     $criteria->addJoin(sfSimpleForumPostPeer::USER_ID, sfGuardUserPeer::ID);
     $rs = sfSimpleForumPostPeer::doSelectRS($criteria, $con);
     if ($rs->next()) {
         return $rs->getInt(1);
     } else {
         return 0;
     }
 }