Changeset 12

Show
Ignore:
Timestamp:
12/04/05 13:34:55 (7 years ago)
Author:
fabien
Message:

day 4 modifications

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/batch/load_data.php

    r6 r12  
    99 
    1010$data = new sfPropelData(); 
    11 $data->loadData(SF_DATA_DIR.'/fixtures'); 
     11$data->loadData(SF_DATA_DIR.DIRECTORY_SEPARATOR.'fixtures'); 
    1212 
    1313?> 
  • trunk/config/schema.xml

    r4 r12  
    88     </foreign-key> 
    99     <column name="title" type="longvarchar" /> 
     10     <column name="stripped_title" type="longvarchar" /> 
    1011     <column name="body" type="longvarchar" /> 
     12     <column name="interested_users" type="integer" default="0" /> 
    1113     <column name="created_at" type="timestamp" /> 
    1214     <column name="updated_at" type="timestamp" /> 
     
    2426     </foreign-key> 
    2527     <column name="body" type="longvarchar" /> 
     28     <column name="relevancy_up" type="integer" default="0" /> 
     29     <column name="relevancy_down" type="integer" default="0" /> 
    2630     <column name="created_at" type="timestamp" /> 
    2731   </table> 
  • trunk/data/fixtures/test_data.yml

    r6 r12  
    1818  q1: 
    1919    title: What shall I do tonight with my girlfriend? 
     20    user_id: fabien 
    2021    body:  | 
    2122      We shall meet in front of the __Dunkin'Doghnuts__ before dinner,  
     
    2728  q2: 
    2829    title: What can I offer to my step mother? 
     30    user_id: anonymous 
    2931    body:  | 
    3032      My stepmother has everything a stepmother is usually offered 
     
    3638  q3: 
    3739    title: How can I generate traffic to my blog? 
     40    user_id: francois 
    3841    body:  | 
    3942      I have a very swell blog that talks  
     
    4548  i3: { user_id: francois, question_id: q2 } 
    4649  i4: { user_id: fabien, question_id: q2 } 
     50 
     51Answer: 
     52  a1_q1: 
     53    question_id: q1 
     54    user_id:     francois 
     55    body:        | 
     56      You can try to read her poetry. Chicks love that kind of things. 
     57 
     58  a2_q1: 
     59    question_id: q1 
     60    user_id:     fabien 
     61    body:        | 
     62      Don't bring her to a doghnuts shop. Ever. Girls don't like to be 
     63      seen eating with their fingers - although it's nice.  
     64 
     65  a3_q1: 
     66    question_id: q2 
     67    user_id:     fabien 
     68    body:        | 
     69      The answer is in the question: buy her a step, so she can  
     70      get some exercise and be grateful for the weight she will 
     71      lose. 
     72 
     73  a4_q1: 
     74    question_id: q3 
     75    user_id:     fabien 
     76    body:        | 
     77      Build it with symfony - and people will love it. 
     78 
     79Relevancy: 
     80  rel1: 
     81    answer_id: a1_q1 
     82    user_id:   fabien 
     83    score:     1 
     84 
     85  rel2: 
     86    answer_id: a1_q1 
     87    user_id:   francois 
     88    score:     -1 
  • trunk/data/sql/schema.sql

    r4 r12  
    1212    `user_id` INTEGER ,  
    1313    `title` TEXT ,  
     14    `stripped_title` TEXT ,  
    1415    `body` TEXT ,  
     16    `interested_users` INTEGER default 0 ,  
    1517    `created_at` DATETIME ,  
    1618    `updated_at` DATETIME ,   
     
    3234    `user_id` INTEGER ,  
    3335    `body` TEXT ,  
     36    `relevancy_up` INTEGER default 0 ,  
     37    `relevancy_down` INTEGER default 0 ,  
    3438    `created_at` DATETIME ,   
    3539    PRIMARY KEY(`id`),   
  • trunk/frontend/config/routing.yml

    r6 r12  
     1question: 
     2  url:   /question/:stripped_title 
     3  param: { module: question, action: show } 
     4 
    15# default rules 
    26homepage: 
  • trunk/frontend/modules/question/actions/actions.class.php

    r6 r12  
    1616  } 
    1717 
    18   public function executeShow () 
     18  public function executeShow() 
    1919  { 
    20     $this->question = QuestionPeer::retrieveByPk($this->getRequestParameter('id')); 
     20    $c = new Criteria(); 
     21    $c->add(QuestionPeer::STRIPPED_TITLE, $this->getRequestParameter('stripped_title')); 
     22    $this->question = QuestionPeer::doSelectOne($c); 
    2123 
    22     $this->forward404Unless($this->question instanceof Question); 
     24    $this->forward404Unless($this->question); 
    2325  } 
    2426} 
  • trunk/frontend/modules/question/templates/listSuccess.php

    r6 r12  
    33<?php foreach($questions as $question): ?> 
    44  <div class="interested_block"> 
    5     <div class="interested_mark" id="interested_in_<?php echo $question->getId() ?>"> 
    6       <?php echo count($question->getInterests()) ?> 
    7     </div> 
     5    <?php echo include_partial('interested_user', array('question' => $question)) ?> 
    86  </div> 
    97 
    10   <h2><?php echo link_to($question->getTitle(), 'question/show?id='.$question->getId()) ?></h2> 
     8  <h2><?php echo link_to($question->getTitle(), 'question/show?stripped_title='.$question->getStrippedTitle()) ?></h2> 
    119 
    1210  <div class="question_body"> 
  • trunk/frontend/modules/question/templates/showSuccess.php

    r4 r12  
    1 <?php 
    2 // auto-generated by sfPropelCrud 
    3 // date: 11/30/2005 15:17:53 
    4 ?> 
    5 <table> 
    6 <tbody> 
    7 <tr> 
    8 <th>Id: </th> 
    9 <td><?php echo $question->getId() ?></td> 
    10 </tr> 
    11 <tr> 
    12 <th>User id: </th> 
    13 <td><?php echo $question->getUserId() ?></td> 
    14 </tr> 
    15 <tr> 
    16 <th>Title: </th> 
    17 <td><?php echo $question->getTitle() ?></td> 
    18 </tr> 
    19 <tr> 
    20 <th>Body: </th> 
    21 <td><?php echo $question->getBody() ?></td> 
    22 </tr> 
    23 <tr> 
    24 <th>Created at: </th> 
    25 <td><?php echo $question->getCreatedAt() ?></td> 
    26 </tr> 
    27 <tr> 
    28 <th>Updated at: </th> 
    29 <td><?php echo $question->getUpdatedAt() ?></td> 
    30 </tr> 
    31 </tbody> 
    32 </table> 
    33 <hr /> 
    34 <?php echo link_to('edit', 'question/edit?id='.$question->getId()) ?> 
    35 &nbsp;<?php echo link_to('list', 'question/list') ?> 
     1<?php use_helper('Date') ?> 
     2 
     3<div class="interested_block"> 
     4  <?php echo include_partial('interested_user', array('question' => $question)) ?> 
     5</div> 
     6     
     7<h2><?php echo $question->getTitle() ?></h2> 
     8     
     9<div class="question_body"> 
     10  <?php echo $question->getBody() ?> 
     11</div> 
     12 
     13<div id="answers"> 
     14<?php foreach($question->getAnswers() as $answer): ?> 
     15  <div> 
     16    <?php echo $answer->getRelevancyUpPercent() ?>% UP <?php echo $answer->getRelevancyDownPercent() ?> % DOWN 
     17    posted by <?php echo $answer->getUser() ?> 
     18    on <?php echo format_date($answer->getCreatedAt(), 'p') ?> 
     19    <div> 
     20      <?php echo $answer->getBody() ?> 
     21    </div> 
     22  </div> 
     23<?php endforeach ?> 
     24</div> 
  • trunk/lib/model/Answer.php

    r4 r12  
    1515 * @package model 
    1616 */  
    17 class Answer extends BaseAnswer { 
     17class Answer extends BaseAnswer 
     18
     19  public function getRelevancyUpPercent() 
     20  { 
     21    $total = $this->getRelevancyUp() + $this->getRelevancyDown(); 
    1822 
    19 } // Answer 
     23    return $total ? sprintf('%02.0f', $this->getRelevancyUp() * 100 / $total) : 0; 
     24  } 
     25 
     26  public function getRelevancyDownPercent() 
     27  { 
     28    $total = $this->getRelevancyUp() + $this->getRelevancyDown(); 
     29 
     30    return $total ? sprintf('%02.0f', $this->getRelevancyDown() * 100 / $total) : 0; 
     31  } 
     32
     33 
     34?> 
  • trunk/lib/model/Interest.php

    r4 r12  
    1515 * @package model 
    1616 */  
    17 class Interest extends BaseInterest { 
     17class Interest extends BaseInterest 
     18
     19  public function save($con = null) 
     20  { 
     21    $con = Propel::getConnection(); 
     22    try 
     23    { 
     24      $con->begin(); 
    1825 
    19 } // Interest 
     26      $ret = parent::save(); 
     27 
     28      // update interested_users in question table 
     29      $question = $this->getQuestion(); 
     30      $interested_users = $question->getInterestedUsers(); 
     31      $question->setInterestedUsers($interested_users + 1); 
     32      $question->save(); 
     33 
     34      $con->commit(); 
     35 
     36      return $ret; 
     37    } 
     38    catch (Exception $e) 
     39    { 
     40      $con->rollback(); 
     41      throw $e; 
     42    } 
     43  } 
     44
     45 
     46?> 
  • trunk/lib/model/Question.php

    r4 r12  
    1515 * @package model 
    1616 */  
    17 class Question extends BaseQuestion { 
     17class Question extends BaseQuestion 
     18
     19  public function setTitle($v) 
     20  { 
     21    parent::setTitle($v); 
    1822 
    19 } // Question 
     23    $this->setStrippedTitle(myTools::stripText($v)); 
     24  } 
     25
     26 
     27?> 
  • trunk/lib/model/Relevancy.php

    r4 r12  
    1515 * @package model 
    1616 */  
    17 class Relevancy extends BaseRelevancy { 
     17class Relevancy extends BaseRelevancy 
     18
     19  public function save($con = null) 
     20  { 
     21    $con = Propel::getConnection(); 
     22    try 
     23    { 
     24      $con->begin(); 
    1825 
    19 } // Relevancy 
     26      $ret = parent::save(); 
     27 
     28      // update relevancy in answer table 
     29      $answer    = $this->getAnswer(); 
     30      if ($this->getScore() == 1) 
     31      { 
     32        $answer->setRelevancyUp($answer->getRelevancyUp() + 1); 
     33      } 
     34      else 
     35      { 
     36        $answer->setRelevancyDown($answer->getRelevancyDown() + 1); 
     37      } 
     38      $answer->save(); 
     39 
     40      $con->commit(); 
     41 
     42      return $ret; 
     43    } 
     44    catch (Exception $e) 
     45    { 
     46      $con->rollback(); 
     47      throw $e; 
     48    } 
     49  } 
     50
     51 
     52?> 
  • trunk/lib/model/User.php

    r4 r12  
    1515 * @package model 
    1616 */  
    17 class User extends BaseUser { 
     17class User extends BaseUser 
     18
     19  public function __toString() 
     20  { 
     21    return $this->getFirstName().' '.$this->getLastName(); 
     22  } 
     23
    1824 
    19 } // User 
     25?> 
  • trunk/lib/model/map/AnswerMapBuilder.php

    r4 r12  
    7373        $tMap->addColumn('BODY', 'Body', 'string', CreoleTypes::LONGVARCHAR, false); 
    7474 
     75        $tMap->addColumn('RELEVANCY_UP', 'RelevancyUp', 'int', CreoleTypes::INTEGER, false); 
     76 
     77        $tMap->addColumn('RELEVANCY_DOWN', 'RelevancyDown', 'int', CreoleTypes::INTEGER, false); 
     78 
    7579        $tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false); 
    7680                 
  • trunk/lib/model/map/QuestionMapBuilder.php

    r4 r12  
    7171        $tMap->addColumn('TITLE', 'Title', 'string', CreoleTypes::LONGVARCHAR, false); 
    7272 
     73        $tMap->addColumn('STRIPPED_TITLE', 'StrippedTitle', 'string', CreoleTypes::LONGVARCHAR, false); 
     74 
    7375        $tMap->addColumn('BODY', 'Body', 'string', CreoleTypes::LONGVARCHAR, false); 
     76 
     77        $tMap->addColumn('INTERESTED_USERS', 'InterestedUsers', 'int', CreoleTypes::INTEGER, false); 
    7478 
    7579        $tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false); 
  • trunk/lib/model/om/BaseAnswer.php

    r4 r12  
    44 
    55require_once 'propel/om/Persistent.php'; 
    6  
    7  
    8 include_once 'propel/util/Criteria.php'; 
    9  
    10 include_once 'model/AnswerPeer.php'; 
    116 
    127/** 
     
    5853 
    5954    /** 
     55     * The value for the relevancy_up field. 
     56     * @var int 
     57     */ 
     58    protected $relevancy_up = 0; 
     59 
     60 
     61    /** 
     62     * The value for the relevancy_down field. 
     63     * @var int 
     64     */ 
     65    protected $relevancy_down = 0; 
     66 
     67 
     68    /** 
    6069     * The value for the created_at field. 
    6170     * @var int 
     
    141150 
    142151        return $this->body; 
     152    } 
     153 
     154    /** 
     155     * Get the [relevancy_up] column value. 
     156     *  
     157     * @return int 
     158     */ 
     159    public function getRelevancyUp() 
     160    { 
     161 
     162        return $this->relevancy_up; 
     163    } 
     164 
     165    /** 
     166     * Get the [relevancy_down] column value. 
     167     *  
     168     * @return int 
     169     */ 
     170    public function getRelevancyDown() 
     171    { 
     172 
     173        return $this->relevancy_down; 
    143174    } 
    144175 
     
    247278 
    248279    /** 
     280     * Set the value of [relevancy_up] column. 
     281     *  
     282     * @param int $v new value 
     283     * @return void 
     284     */ 
     285    public function setRelevancyUp($v) 
     286    { 
     287 
     288        if ($this->relevancy_up !== $v || $v === 0) { 
     289            $this->relevancy_up = $v; 
     290            $this->modifiedColumns[] = AnswerPeer::RELEVANCY_UP; 
     291        } 
     292 
     293    } // setRelevancyUp() 
     294 
     295    /** 
     296     * Set the value of [relevancy_down] column. 
     297     *  
     298     * @param int $v new value 
     299     * @return void 
     300     */ 
     301    public function setRelevancyDown($v) 
     302    { 
     303 
     304        if ($this->relevancy_down !== $v || $v === 0) { 
     305            $this->relevancy_down = $v; 
     306            $this->modifiedColumns[] = AnswerPeer::RELEVANCY_DOWN; 
     307        } 
     308 
     309    } // setRelevancyDown() 
     310 
     311    /** 
    249312     * Set the value of [created_at] column. 
    250313     *  
     
    295358            $this->body = $rs->getString($startcol + 3); 
    296359 
    297             $this->created_at = $rs->getTimestamp($startcol + 4, null); 
     360            $this->relevancy_up = $rs->getInt($startcol + 4); 
     361 
     362            $this->relevancy_down = $rs->getInt($startcol + 5); 
     363 
     364            $this->created_at = $rs->getTimestamp($startcol + 6, null); 
    298365 
    299366            $this->resetModified(); 
     
    302369 
    303370            // FIXME - using NUM_COLUMNS may be clearer. 
    304             return $startcol + 5; // 5 = AnswerPeer::NUM_COLUMNS - AnswerPeer::NUM_LAZY_LOAD_COLUMNS). 
     371            return $startcol + 7; // 7 = AnswerPeer::NUM_COLUMNS - AnswerPeer::NUM_LAZY_LOAD_COLUMNS). 
    305372 
    306373        } catch (Exception $e) { 
     
    558625                break; 
    559626            case 4: 
     627                return $this->getRelevancyUp(); 
     628                break; 
     629            case 5: 
     630                return $this->getRelevancyDown(); 
     631                break; 
     632            case 6: 
    560633                return $this->getCreatedAt(); 
    561634                break; 
     
    584657            $keys[2] => $this->getUserId(), 
    585658            $keys[3] => $this->getBody(), 
    586             $keys[4] => $this->getCreatedAt(), 
     659            $keys[4] => $this->getRelevancyUp(), 
     660            $keys[5] => $this->getRelevancyDown(), 
     661            $keys[6] => $this->getCreatedAt(), 
    587662        ); 
    588663        return $result; 
     
    630705                break; 
    631706            case 4: 
     707                $this->setRelevancyUp($value); 
     708                break; 
     709            case 5: 
     710                $this->setRelevancyDown($value); 
     711                break; 
     712            case 6: 
    632713                $this->setCreatedAt($value); 
    633714                break; 
     
    659740        if (array_key_exists($keys[2], $arr)) $this->setUserId($arr[$keys[2]]); 
    660741        if (array_key_exists($keys[3], $arr)) $this->setBody($arr[$keys[3]]); 
    661         if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]); 
     742        if (array_key_exists($keys[4], $arr)) $this->setRelevancyUp($arr[$keys[4]]); 
     743        if (array_key_exists($keys[5], $arr)) $this->setRelevancyDown($arr[$keys[5]]); 
     744        if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]); 
    662745    } 
    663746 
     
    675758        if ($this->isColumnModified(AnswerPeer::USER_ID)) $criteria->add(AnswerPeer::USER_ID, $this->user_id); 
    676759        if ($this->isColumnModified(AnswerPeer::BODY)) $criteria->add(AnswerPeer::BODY, $this->body); 
     760        if ($this->isColumnModified(AnswerPeer::RELEVANCY_UP)) $criteria->add(AnswerPeer::RELEVANCY_UP, $this->relevancy_up); 
     761        if ($this->isColumnModified(AnswerPeer::RELEVANCY_DOWN)) $criteria->add(AnswerPeer::RELEVANCY_DOWN, $this->relevancy_down); 
    677762        if ($this->isColumnModified(AnswerPeer::CREATED_AT)) $criteria->add(AnswerPeer::CREATED_AT, $this->created_at); 
    678763 
     
    735820 
    736821        $copyObj->setBody($this->body); 
     822 
     823        $copyObj->setRelevancyUp($this->relevancy_up); 
     824 
     825        $copyObj->setRelevancyDown($this->relevancy_down); 
    737826 
    738827        $copyObj->setCreatedAt($this->created_at); 
  • trunk/lib/model/om/BaseAnswerPeer.php

    r4 r12  
    22 
    33require_once 'propel/util/BasePeer.php'; 
    4 // The object class -- needed for instanceof checks in this class. 
    5 // actual class may be a subclass -- as returned by AnswerPeer::getOMClass() 
    6 include_once 'model/Answer.php'; 
    74 
    85/** 
     
    2522 
    2623    /** The total number of columns. */ 
    27     const NUM_COLUMNS = 5
     24    const NUM_COLUMNS = 7
    2825 
    2926    /** The number of lazy-loaded columns. */ 
     
    4340    const BODY = 'ask_answer.BODY'; 
    4441 
     42    /** the column name for the RELEVANCY_UP field */ 
     43    const RELEVANCY_UP = 'ask_answer.RELEVANCY_UP'; 
     44 
     45    /** the column name for the RELEVANCY_DOWN field */ 
     46    const RELEVANCY_DOWN = 'ask_answer.RELEVANCY_DOWN'; 
     47 
    4548    /** the column name for the CREATED_AT field */ 
    4649    const CREATED_AT = 'ask_answer.CREATED_AT'; 
     
    5760     */ 
    5861    private static $fieldNames = array ( 
    59         BasePeer::TYPE_PHPNAME => array ('Id', 'QuestionId', 'UserId', 'Body', 'CreatedAt', ), 
    60         BasePeer::TYPE_COLNAME => array (AnswerPeer::ID, AnswerPeer::QUESTION_ID, AnswerPeer::USER_ID, AnswerPeer::BODY, AnswerPeer::CREATED_AT, ), 
    61         BasePeer::TYPE_FIELDNAME => array ('id', 'question_id', 'user_id', 'body', 'created_at', ), 
    62         BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4,
     62        BasePeer::TYPE_PHPNAME => array ('Id', 'QuestionId', 'UserId', 'Body', 'RelevancyUp', 'RelevancyDown', 'CreatedAt', ), 
     63        BasePeer::TYPE_COLNAME => array (AnswerPeer::ID, AnswerPeer::QUESTION_ID, AnswerPeer::USER_ID, AnswerPeer::BODY, AnswerPeer::RELEVANCY_UP, AnswerPeer::RELEVANCY_DOWN, AnswerPeer::CREATED_AT, ), 
     64        BasePeer::TYPE_FIELDNAME => array ('id', 'question_id', 'user_id', 'body', 'relevancy_up', 'relevancy_down', 'created_at', ), 
     65        BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6,
    6366    ); 
    6467 
     
    7073     */ 
    7174    private static $fieldKeys = array ( 
    72         BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'QuestionId' => 1, 'UserId' => 2, 'Body' => 3, 'CreatedAt' => 4, ), 
    73         BasePeer::TYPE_COLNAME => array (AnswerPeer::ID => 0, AnswerPeer::QUESTION_ID => 1, AnswerPeer::USER_ID => 2, AnswerPeer::BODY => 3, AnswerPeer::CREATED_AT => 4, ), 
    74         BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'question_id' => 1, 'user_id' => 2, 'body' => 3, 'created_at' => 4, ), 
    75         BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4,
     75        BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'QuestionId' => 1, 'UserId' => 2, 'Body' => 3, 'RelevancyUp' => 4, 'RelevancyDown' => 5, 'CreatedAt' => 6, ), 
     76        BasePeer::TYPE_COLNAME => array (AnswerPeer::ID => 0, AnswerPeer::QUESTION_ID => 1, AnswerPeer::USER_ID => 2, AnswerPeer::BODY => 3, AnswerPeer::RELEVANCY_UP => 4, AnswerPeer::RELEVANCY_DOWN => 5, AnswerPeer::CREATED_AT => 6, ), 
     77        BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'question_id' => 1, 'user_id' => 2, 'body' => 3, 'relevancy_up' => 4, 'relevancy_down' => 5, 'created_at' => 6, ), 
     78        BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6,
    7679    ); 
    7780 
     
    181184 
    182185        $criteria->addSelectColumn(AnswerPeer::BODY); 
     186 
     187        $criteria->addSelectColumn(AnswerPeer::RELEVANCY_UP); 
     188 
     189        $criteria->addSelectColumn(AnswerPeer::RELEVANCY_DOWN); 
    183190 
    184191        $criteria->addSelectColumn(AnswerPeer::CREATED_AT); 
  • trunk/lib/model/om/BaseInterest.php

    r4 r12  
    44 
    55require_once 'propel/om/Persistent.php'; 
    6  
    7  
    8 include_once 'propel/util/Criteria.php'; 
    9  
    10 include_once 'model/InterestPeer.php'; 
    116 
    127/** 
  • trunk/lib/model/om/BaseInterestPeer.php

    r4 r12  
    22 
    33require_once 'propel/util/BasePeer.php'; 
    4 // The object class -- needed for instanceof checks in this class. 
    5 // actual class may be a subclass -- as returned by InterestPeer::getOMClass() 
    6 include_once 'model/Interest.php'; 
    74 
    85/** 
  • trunk/lib/model/om/BaseQuestion.php

    r4 r12  
    44 
    55require_once 'propel/om/Persistent.php'; 
    6  
    7  
    8 include_once 'propel/util/Criteria.php'; 
    9  
    10 include_once 'model/QuestionPeer.php'; 
    116 
    127/** 
     
    5146 
    5247    /** 
     48     * The value for the stripped_title field. 
     49     * @var string 
     50     */ 
     51    protected $stripped_title; 
     52 
     53 
     54    /** 
    5355     * The value for the body field. 
    5456     * @var string 
    5557     */ 
    5658    protected $body; 
     59 
     60 
     61    /** 
     62     * The value for the interested_users field. 
     63     * @var int 
     64     */ 
     65    protected $interested_users = 0; 
    5766 
    5867 
     
    147156 
    148157    /** 
     158     * Get the [stripped_title] column value. 
     159     *  
     160     * @return string 
     161     */ 
     162    public function getStrippedTitle() 
     163    { 
     164 
     165        return $this->stripped_title; 
     166    } 
     167 
     168    /** 
    149169     * Get the [body] column value. 
    150170     *  
     
    155175 
    156176        return $this->body; 
     177    } 
     178 
     179    /** 
     180     * Get the [interested_users] column value. 
     181     *  
     182     * @return int 
     183     */ 
     184    public function getInterestedUsers() 
     185    { 
     186 
     187        return $this->interested_users; 
    157188    } 
    158189 
     
    272303 
    273304    /** 
     305     * Set the value of [stripped_title] column. 
     306     *  
     307     * @param string $v new value 
     308     * @return void 
     309     */ 
     310    public function setStrippedTitle($v) 
     311    { 
     312 
     313        if ($this->stripped_title !== $v) { 
     314            $this->stripped_title = $v; 
     315            $this->modifiedColumns[] = QuestionPeer::STRIPPED_TITLE; 
     316        } 
     317 
     318    } // setStrippedTitle() 
     319 
     320    /** 
    274321     * Set the value of [body] column. 
    275322     *  
     
    286333 
    287334    } // setBody() 
     335 
     336    /** 
     337     * Set the value of [interested_users] column. 
     338     *  
     339     * @param int $v new value 
     340     * @return void 
     341     */ 
     342    public function setInterestedUsers($v) 
     343    { 
     344 
     345        if ($this->interested_users !== $v || $v === 0) { 
     346            $this->interested_users = $v; 
     347            $this->modifiedColumns[] = QuestionPeer::INTERESTED_USERS; 
     348        } 
     349 
     350    } // setInterestedUsers() 
    288351 
    289352    /** 
     
    358421            $this->title = $rs->getString($startcol + 2); 
    359422 
    360             $this->body = $rs->getString($startcol + 3); 
    361  
    362             $this->created_at = $rs->getTimestamp($startcol + 4, null); 
    363  
    364             $this->updated_at = $rs->getTimestamp($startcol + 5, null); 
     423            $this->stripped_title = $rs->getString($startcol + 3); 
     424 
     425            $this->body = $rs->getString($startcol + 4); 
     426 
     427            $this->interested_users = $rs->getInt($startcol + 5); 
     428 
     429            $this->created_at = $rs->getTimestamp($startcol + 6, null); 
     430 
     431            $this->updated_at = $rs->getTimestamp($startcol + 7, null); 
    365432 
    366433            $this->resetModified(); 
     
    369436 
    370437            // FIXME - using NUM_COLUMNS may be clearer. 
    371             return $startcol + 6; // 6 = QuestionPeer::NUM_COLUMNS - QuestionPeer::NUM_LAZY_LOAD_COLUMNS). 
     438            return $startcol + 8; // 8 = QuestionPeer::NUM_COLUMNS - QuestionPeer::NUM_LAZY_LOAD_COLUMNS). 
    372439 
    373440        } catch (Exception $e) { 
     
    626693                break; 
    627694            case 3: 
     695                return $this->getStrippedTitle(); 
     696                break; 
     697            case 4: 
    628698                return $this->getBody(); 
    629699                break; 
    630             case 4: 
     700            case 5: 
     701                return $this->getInterestedUsers(); 
     702                break; 
     703            case 6: 
    631704                return $this->getCreatedAt(); 
    632705                break; 
    633             case 5
     706            case 7
    634707                return $this->getUpdatedAt(); 
    635708                break; 
     
    657730            $keys[1] => $this->getUserId(), 
    658731            $keys[2] => $this->getTitle(), 
    659             $keys[3] => $this->getBody(), 
    660             $keys[4] => $this->getCreatedAt(), 
    661             $keys[5] => $this->getUpdatedAt(), 
     732            $keys[3] => $this->getStrippedTitle(), 
     733            $keys[4] => $this->getBody(), 
     734            $keys[5] => $this->getInterestedUsers(), 
     735            $keys[6] => $this->getCreatedAt(), 
     736            $keys[7] => $this->getUpdatedAt(), 
    662737        ); 
    663738        return $result; 
     
    702777                break; 
    703778            case 3: 
     779                $this->setStrippedTitle($value); 
     780                break; 
     781            case 4: 
    704782                $this->setBody($value); 
    705783                break; 
    706             case 4: 
     784            case 5: 
     785                $this->setInterestedUsers($value); 
     786                break; 
     787            case 6: 
    707788                $this->setCreatedAt($value); 
    708789                break; 
    709             case 5
     790            case 7
    710791                $this->setUpdatedAt($value); 
    711792                break; 
     
    736817        if (array_key_exists($keys[1], $arr)) $this->setUserId($arr[$keys[1]]); 
    737818        if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]); 
    738         if (array_key_exists($keys[3], $arr)) $this->setBody($arr[$keys[3]]); 
    739         if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]); 
    740         if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]); 
     819        if (array_key_exists($keys[3], $arr)) $this->setStrippedTitle($arr[$keys[3]]); 
     820        if (array_key_exists($keys[4], $arr)) $this->setBody($arr[$keys[4]]); 
     821        if (array_key_exists($keys[5], $arr)) $this->setInterestedUsers($arr[$keys[5]]); 
     822        if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]); 
     823        if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]); 
    741824    } 
    742825 
     
    753836        if ($this->isColumnModified(QuestionPeer::USER_ID)) $criteria->add(QuestionPeer::USER_ID, $this->user_id); 
    754837        if ($this->isColumnModified(QuestionPeer::TITLE)) $criteria->add(QuestionPeer::TITLE, $this->title); 
     838        if ($this->isColumnModified(QuestionPeer::STRIPPED_TITLE)) $criteria->add(QuestionPeer::STRIPPED_TITLE, $this->stripped_title); 
    755839        if ($this->isColumnModified(QuestionPeer::BODY)) $criteria->add(QuestionPeer::BODY, $this->body); 
     840        if ($this->isColumnModified(QuestionPeer::INTERESTED_USERS)) $criteria->add(QuestionPeer::INTERESTED_USERS, $this->interested_users); 
    756841        if ($this->isColumnModified(QuestionPeer::CREATED_AT)) $criteria->add(QuestionPeer::CREATED_AT, $this->created_at); 
    757842        if ($this->isColumnModified(QuestionPeer::UPDATED_AT)) $criteria->add(QuestionPeer::UPDATED_AT, $this->updated_at); 
     
    814899        $copyObj->setTitle($this->title); 
    815900 
     901        $copyObj->setStrippedTitle($this->stripped_title); 
     902 
    816903        $copyObj->setBody($this->body); 
     904 
     905        $copyObj->setInterestedUsers($this->interested_users); 
    817906 
    818907        $copyObj->setCreatedAt($this->created_at); 
  • trunk/lib/model/om/BaseQuestionPeer.php

    r4 r12  
    22 
    33require_once 'propel/util/BasePeer.php'; 
    4 // The object class -- needed for instanceof checks in this class. 
    5 // actual class may be a subclass -- as returned by QuestionPeer::getOMClass() 
    6 include_once 'model/Question.php'; 
    74 
    85/** 
     
    2522 
    2623    /** The total number of columns. */ 
    27     const NUM_COLUMNS = 6
     24    const NUM_COLUMNS = 8
    2825 
    2926    /** The number of lazy-loaded columns. */ 
     
    4037    const TITLE = 'ask_question.TITLE'; 
    4138 
     39    /** the column name for the STRIPPED_TITLE field */ 
     40    const STRIPPED_TITLE = 'ask_question.STRIPPED_TITLE'; 
     41 
    4242    /** the column name for the BODY field */ 
    4343    const BODY = 'ask_question.BODY'; 
    4444 
     45    /** the column name for the INTERESTED_USERS field */ 
     46    const INTERESTED_USERS = 'ask_question.INTERESTED_USERS'; 
     47 
    4548    /** the column name for the CREATED_AT field */ 
    4649    const CREATED_AT = 'ask_question.CREATED_AT'; 
     
    6063     */ 
    6164    private static $fieldNames = array ( 
    62         BasePeer::TYPE_PHPNAME => array ('Id', 'UserId', 'Title', 'Body', 'CreatedAt', 'UpdatedAt', ), 
    63         BasePeer::TYPE_COLNAME => array (QuestionPeer::ID, QuestionPeer::USER_ID, QuestionPeer::TITLE, QuestionPeer::BODY, QuestionPeer::CREATED_AT, QuestionPeer::UPDATED_AT, ), 
    64         BasePeer::TYPE_FIELDNAME => array ('id', 'user_id', 'title', 'body', 'created_at', 'updated_at', ), 
    65         BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5,
     65        BasePeer::TYPE_PHPNAME => array ('Id', 'UserId', 'Title', 'StrippedTitle', 'Body', 'InterestedUsers', 'CreatedAt', 'UpdatedAt', ), 
     66        BasePeer::TYPE_COLNAME => array (QuestionPeer::ID, QuestionPeer::USER_ID, QuestionPeer::TITLE, QuestionPeer::STRIPPED_TITLE, QuestionPeer::BODY, QuestionPeer::INTERESTED_USERS, QuestionPeer::CREATED_AT, QuestionPeer::UPDATED_AT, ), 
     67        BasePeer::TYPE_FIELDNAME => array ('id', 'user_id', 'title', 'stripped_title', 'body', 'interested_users', 'created_at', 'updated_at', ), 
     68        BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7,
    6669    ); 
    6770 
     
    7376     */ 
    7477    private static $fieldKeys = array ( 
    75         BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'UserId' => 1, 'Title' => 2, 'Body' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ), 
    76         BasePeer::TYPE_COLNAME => array (QuestionPeer::ID => 0, QuestionPeer::USER_ID => 1, QuestionPeer::TITLE => 2, QuestionPeer::BODY => 3, QuestionPeer::CREATED_AT => 4, QuestionPeer::UPDATED_AT => 5, ), 
    77         BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'user_id' => 1, 'title' => 2, 'body' => 3, 'created_at' => 4, 'updated_at' => 5, ), 
    78         BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5,
     78        BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'UserId' => 1, 'Title' => 2, 'StrippedTitle' => 3, 'Body' => 4, 'InterestedUsers' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ), 
     79        BasePeer::TYPE_COLNAME => array (QuestionPeer::ID => 0, QuestionPeer::USER_ID => 1, QuestionPeer::TITLE => 2, QuestionPeer::STRIPPED_TITLE => 3, QuestionPeer::BODY => 4, QuestionPeer::INTERESTED_USERS => 5, QuestionPeer::CREATED_AT => 6, QuestionPeer::UPDATED_AT => 7, ), 
     80        BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'user_id' => 1, 'title' => 2, 'stripped_title' => 3, 'body' => 4, 'interested_users' => 5, 'created_at' => 6, 'updated_at' => 7, ), 
     81        BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7,
    7982    ); 
    8083 
     
    183186        $criteria->addSelectColumn(QuestionPeer::TITLE); 
    184187 
     188        $criteria->addSelectColumn(QuestionPeer::STRIPPED_TITLE); 
     189 
    185190        $criteria->addSelectColumn(QuestionPeer::BODY); 
     191 
     192        $criteria->addSelectColumn(QuestionPeer::INTERESTED_USERS); 
    186193 
    187194        $criteria->addSelectColumn(QuestionPeer::CREATED_AT); 
  • trunk/lib/model/om/BaseRelevancy.php

    r4 r12  
    44 
    55require_once 'propel/om/Persistent.php'; 
    6  
    7  
    8 include_once 'propel/util/Criteria.php'; 
    9  
    10 include_once 'model/RelevancyPeer.php'; 
    116 
    127/** 
  • trunk/lib/model/om/BaseRelevancyPeer.php

    r4 r12  
    22 
    33require_once 'propel/util/BasePeer.php'; 
    4 // The object class -- needed for instanceof checks in this class. 
    5 // actual class may be a subclass -- as returned by RelevancyPeer::getOMClass() 
    6 include_once 'model/Relevancy.php'; 
    74 
    85/** 
  • trunk/lib/model/om/BaseUser.php

    r4 r12  
    44 
    55require_once 'propel/om/Persistent.php'; 
    6  
    7  
    8 include_once 'propel/util/Criteria.php'; 
    9  
    10 include_once 'model/UserPeer.php'; 
    116 
    127/** 
  • trunk/lib/model/om/BaseUserPeer.php

    r4 r12  
    22 
    33require_once 'propel/util/BasePeer.php'; 
    4 // The object class -- needed for instanceof checks in this class. 
    5 // actual class may be a subclass -- as returned by UserPeer::getOMClass() 
    6 include_once 'model/User.php'; 
    74 
    85/**