Changeset 12
- Timestamp:
- 12/04/05 13:34:55 (7 years ago)
- Files:
-
- trunk/batch/load_data.php (modified) (1 diff)
- trunk/config/schema.xml (modified) (2 diffs)
- trunk/config/schema.xml.sample (deleted)
- trunk/data/fixtures/test_data.yml (modified) (4 diffs)
- trunk/data/sql/schema.sql (modified) (2 diffs)
- trunk/frontend/config/routing.yml (modified) (1 diff)
- trunk/frontend/modules/question/actions/actions.class.php (modified) (1 diff)
- trunk/frontend/modules/question/templates/_interested_user.php (added)
- trunk/frontend/modules/question/templates/listSuccess.php (modified) (1 diff)
- trunk/frontend/modules/question/templates/showSuccess.php (modified) (1 diff)
- trunk/lib/model/Answer.php (modified) (1 diff)
- trunk/lib/model/Interest.php (modified) (1 diff)
- trunk/lib/model/Question.php (modified) (1 diff)
- trunk/lib/model/Relevancy.php (modified) (1 diff)
- trunk/lib/model/User.php (modified) (1 diff)
- trunk/lib/model/map/AnswerMapBuilder.php (modified) (1 diff)
- trunk/lib/model/map/QuestionMapBuilder.php (modified) (1 diff)
- trunk/lib/model/om/BaseAnswer.php (modified) (12 diffs)
- trunk/lib/model/om/BaseAnswerPeer.php (modified) (6 diffs)
- trunk/lib/model/om/BaseInterest.php (modified) (1 diff)
- trunk/lib/model/om/BaseInterestPeer.php (modified) (1 diff)
- trunk/lib/model/om/BaseQuestion.php (modified) (14 diffs)
- trunk/lib/model/om/BaseQuestionPeer.php (modified) (6 diffs)
- trunk/lib/model/om/BaseRelevancy.php (modified) (1 diff)
- trunk/lib/model/om/BaseRelevancyPeer.php (modified) (1 diff)
- trunk/lib/model/om/BaseUser.php (modified) (1 diff)
- trunk/lib/model/om/BaseUserPeer.php (modified) (1 diff)
- trunk/lib/myTools.class.php (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/batch/load_data.php
r6 r12 9 9 10 10 $data = new sfPropelData(); 11 $data->loadData(SF_DATA_DIR. '/fixtures');11 $data->loadData(SF_DATA_DIR.DIRECTORY_SEPARATOR.'fixtures'); 12 12 13 13 ?> trunk/config/schema.xml
r4 r12 8 8 </foreign-key> 9 9 <column name="title" type="longvarchar" /> 10 <column name="stripped_title" type="longvarchar" /> 10 11 <column name="body" type="longvarchar" /> 12 <column name="interested_users" type="integer" default="0" /> 11 13 <column name="created_at" type="timestamp" /> 12 14 <column name="updated_at" type="timestamp" /> … … 24 26 </foreign-key> 25 27 <column name="body" type="longvarchar" /> 28 <column name="relevancy_up" type="integer" default="0" /> 29 <column name="relevancy_down" type="integer" default="0" /> 26 30 <column name="created_at" type="timestamp" /> 27 31 </table> trunk/data/fixtures/test_data.yml
r6 r12 18 18 q1: 19 19 title: What shall I do tonight with my girlfriend? 20 user_id: fabien 20 21 body: | 21 22 We shall meet in front of the __Dunkin'Doghnuts__ before dinner, … … 27 28 q2: 28 29 title: What can I offer to my step mother? 30 user_id: anonymous 29 31 body: | 30 32 My stepmother has everything a stepmother is usually offered … … 36 38 q3: 37 39 title: How can I generate traffic to my blog? 40 user_id: francois 38 41 body: | 39 42 I have a very swell blog that talks … … 45 48 i3: { user_id: francois, question_id: q2 } 46 49 i4: { user_id: fabien, question_id: q2 } 50 51 Answer: 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 79 Relevancy: 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 12 12 `user_id` INTEGER , 13 13 `title` TEXT , 14 `stripped_title` TEXT , 14 15 `body` TEXT , 16 `interested_users` INTEGER default 0 , 15 17 `created_at` DATETIME , 16 18 `updated_at` DATETIME , … … 32 34 `user_id` INTEGER , 33 35 `body` TEXT , 36 `relevancy_up` INTEGER default 0 , 37 `relevancy_down` INTEGER default 0 , 34 38 `created_at` DATETIME , 35 39 PRIMARY KEY(`id`), trunk/frontend/config/routing.yml
r6 r12 1 question: 2 url: /question/:stripped_title 3 param: { module: question, action: show } 4 1 5 # default rules 2 6 homepage: trunk/frontend/modules/question/actions/actions.class.php
r6 r12 16 16 } 17 17 18 public function executeShow ()18 public function executeShow() 19 19 { 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); 21 23 22 $this->forward404Unless($this->question instanceof Question);24 $this->forward404Unless($this->question); 23 25 } 24 26 } trunk/frontend/modules/question/templates/listSuccess.php
r6 r12 3 3 <?php foreach($questions as $question): ?> 4 4 <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)) ?> 8 6 </div> 9 7 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> 11 9 12 10 <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 <?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 15 15 * @package model 16 16 */ 17 class Answer extends BaseAnswer { 17 class Answer extends BaseAnswer 18 { 19 public function getRelevancyUpPercent() 20 { 21 $total = $this->getRelevancyUp() + $this->getRelevancyDown(); 18 22 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 15 15 * @package model 16 16 */ 17 class Interest extends BaseInterest { 17 class Interest extends BaseInterest 18 { 19 public function save($con = null) 20 { 21 $con = Propel::getConnection(); 22 try 23 { 24 $con->begin(); 18 25 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 15 15 * @package model 16 16 */ 17 class Question extends BaseQuestion { 17 class Question extends BaseQuestion 18 { 19 public function setTitle($v) 20 { 21 parent::setTitle($v); 18 22 19 } // Question 23 $this->setStrippedTitle(myTools::stripText($v)); 24 } 25 } 26 27 ?> trunk/lib/model/Relevancy.php
r4 r12 15 15 * @package model 16 16 */ 17 class Relevancy extends BaseRelevancy { 17 class Relevancy extends BaseRelevancy 18 { 19 public function save($con = null) 20 { 21 $con = Propel::getConnection(); 22 try 23 { 24 $con->begin(); 18 25 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 15 15 * @package model 16 16 */ 17 class User extends BaseUser { 17 class User extends BaseUser 18 { 19 public function __toString() 20 { 21 return $this->getFirstName().' '.$this->getLastName(); 22 } 23 } 18 24 19 } // User 25 ?> trunk/lib/model/map/AnswerMapBuilder.php
r4 r12 73 73 $tMap->addColumn('BODY', 'Body', 'string', CreoleTypes::LONGVARCHAR, false); 74 74 75 $tMap->addColumn('RELEVANCY_UP', 'RelevancyUp', 'int', CreoleTypes::INTEGER, false); 76 77 $tMap->addColumn('RELEVANCY_DOWN', 'RelevancyDown', 'int', CreoleTypes::INTEGER, false); 78 75 79 $tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false); 76 80 trunk/lib/model/map/QuestionMapBuilder.php
r4 r12 71 71 $tMap->addColumn('TITLE', 'Title', 'string', CreoleTypes::LONGVARCHAR, false); 72 72 73 $tMap->addColumn('STRIPPED_TITLE', 'StrippedTitle', 'string', CreoleTypes::LONGVARCHAR, false); 74 73 75 $tMap->addColumn('BODY', 'Body', 'string', CreoleTypes::LONGVARCHAR, false); 76 77 $tMap->addColumn('INTERESTED_USERS', 'InterestedUsers', 'int', CreoleTypes::INTEGER, false); 74 78 75 79 $tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false); trunk/lib/model/om/BaseAnswer.php
r4 r12 4 4 5 5 require_once 'propel/om/Persistent.php'; 6 7 8 include_once 'propel/util/Criteria.php';9 10 include_once 'model/AnswerPeer.php';11 6 12 7 /** … … 58 53 59 54 /** 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 /** 60 69 * The value for the created_at field. 61 70 * @var int … … 141 150 142 151 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; 143 174 } 144 175 … … 247 278 248 279 /** 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 /** 249 312 * Set the value of [created_at] column. 250 313 * … … 295 358 $this->body = $rs->getString($startcol + 3); 296 359 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); 298 365 299 366 $this->resetModified(); … … 302 369 303 370 // 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). 305 372 306 373 } catch (Exception $e) { … … 558 625 break; 559 626 case 4: 627 return $this->getRelevancyUp(); 628 break; 629 case 5: 630 return $this->getRelevancyDown(); 631 break; 632 case 6: 560 633 return $this->getCreatedAt(); 561 634 break; … … 584 657 $keys[2] => $this->getUserId(), 585 658 $keys[3] => $this->getBody(), 586 $keys[4] => $this->getCreatedAt(), 659 $keys[4] => $this->getRelevancyUp(), 660 $keys[5] => $this->getRelevancyDown(), 661 $keys[6] => $this->getCreatedAt(), 587 662 ); 588 663 return $result; … … 630 705 break; 631 706 case 4: 707 $this->setRelevancyUp($value); 708 break; 709 case 5: 710 $this->setRelevancyDown($value); 711 break; 712 case 6: 632 713 $this->setCreatedAt($value); 633 714 break; … … 659 740 if (array_key_exists($keys[2], $arr)) $this->setUserId($arr[$keys[2]]); 660 741 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]]); 662 745 } 663 746 … … 675 758 if ($this->isColumnModified(AnswerPeer::USER_ID)) $criteria->add(AnswerPeer::USER_ID, $this->user_id); 676 759 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); 677 762 if ($this->isColumnModified(AnswerPeer::CREATED_AT)) $criteria->add(AnswerPeer::CREATED_AT, $this->created_at); 678 763 … … 735 820 736 821 $copyObj->setBody($this->body); 822 823 $copyObj->setRelevancyUp($this->relevancy_up); 824 825 $copyObj->setRelevancyDown($this->relevancy_down); 737 826 738 827 $copyObj->setCreatedAt($this->created_at); trunk/lib/model/om/BaseAnswerPeer.php
r4 r12 2 2 3 3 require_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';7 4 8 5 /** … … 25 22 26 23 /** The total number of columns. */ 27 const NUM_COLUMNS = 5;24 const NUM_COLUMNS = 7; 28 25 29 26 /** The number of lazy-loaded columns. */ … … 43 40 const BODY = 'ask_answer.BODY'; 44 41 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 45 48 /** the column name for the CREATED_AT field */ 46 49 const CREATED_AT = 'ask_answer.CREATED_AT'; … … 57 60 */ 58 61 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, ) 63 66 ); 64 67 … … 70 73 */ 71 74 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, ) 76 79 ); 77 80 … … 181 184 182 185 $criteria->addSelectColumn(AnswerPeer::BODY); 186 187 $criteria->addSelectColumn(AnswerPeer::RELEVANCY_UP); 188 189 $criteria->addSelectColumn(AnswerPeer::RELEVANCY_DOWN); 183 190 184 191 $criteria->addSelectColumn(AnswerPeer::CREATED_AT); trunk/lib/model/om/BaseInterest.php
r4 r12 4 4 5 5 require_once 'propel/om/Persistent.php'; 6 7 8 include_once 'propel/util/Criteria.php';9 10 include_once 'model/InterestPeer.php';11 6 12 7 /** trunk/lib/model/om/BaseInterestPeer.php
r4 r12 2 2 3 3 require_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';7 4 8 5 /** trunk/lib/model/om/BaseQuestion.php
r4 r12 4 4 5 5 require_once 'propel/om/Persistent.php'; 6 7 8 include_once 'propel/util/Criteria.php';9 10 include_once 'model/QuestionPeer.php';11 6 12 7 /** … … 51 46 52 47 /** 48 * The value for the stripped_title field. 49 * @var string 50 */ 51 protected $stripped_title; 52 53 54 /** 53 55 * The value for the body field. 54 56 * @var string 55 57 */ 56 58 protected $body; 59 60 61 /** 62 * The value for the interested_users field. 63 * @var int 64 */ 65 protected $interested_users = 0; 57 66 58 67 … … 147 156 148 157 /** 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 /** 149 169 * Get the [body] column value. 150 170 * … … 155 175 156 176 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; 157 188 } 158 189 … … 272 303 273 304 /** 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 /** 274 321 * Set the value of [body] column. 275 322 * … … 286 333 287 334 } // 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() 288 351 289 352 /** … … 358 421 $this->title = $rs->getString($startcol + 2); 359 422 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); 365 432 366 433 $this->resetModified(); … … 369 436 370 437 // 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). 372 439 373 440 } catch (Exception $e) { … … 626 693 break; 627 694 case 3: 695 return $this->getStrippedTitle(); 696 break; 697 case 4: 628 698 return $this->getBody(); 629 699 break; 630 case 4: 700 case 5: 701 return $this->getInterestedUsers(); 702 break; 703 case 6: 631 704 return $this->getCreatedAt(); 632 705 break; 633 case 5:706 case 7: 634 707 return $this->getUpdatedAt(); 635 708 break; … … 657 730 $keys[1] => $this->getUserId(), 658 731 $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(), 662 737 ); 663 738 return $result; … … 702 777 break; 703 778 case 3: 779 $this->setStrippedTitle($value); 780 break; 781 case 4: 704 782 $this->setBody($value); 705 783 break; 706 case 4: 784 case 5: 785 $this->setInterestedUsers($value); 786 break; 787 case 6: 707 788 $this->setCreatedAt($value); 708 789 break; 709 case 5:790 case 7: 710 791 $this->setUpdatedAt($value); 711 792 break; … … 736 817 if (array_key_exists($keys[1], $arr)) $this->setUserId($arr[$keys[1]]); 737 818 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]]); 741 824 } 742 825 … … 753 836 if ($this->isColumnModified(QuestionPeer::USER_ID)) $criteria->add(QuestionPeer::USER_ID, $this->user_id); 754 837 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); 755 839 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); 756 841 if ($this->isColumnModified(QuestionPeer::CREATED_AT)) $criteria->add(QuestionPeer::CREATED_AT, $this->created_at); 757 842 if ($this->isColumnModified(QuestionPeer::UPDATED_AT)) $criteria->add(QuestionPeer::UPDATED_AT, $this->updated_at); … … 814 899 $copyObj->setTitle($this->title); 815 900 901 $copyObj->setStrippedTitle($this->stripped_title); 902 816 903 $copyObj->setBody($this->body); 904 905 $copyObj->setInterestedUsers($this->interested_users); 817 906 818 907 $copyObj->setCreatedAt($this->created_at); trunk/lib/model/om/BaseQuestionPeer.php
r4 r12 2 2 3 3 require_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';7 4 8 5 /** … … 25 22 26 23 /** The total number of columns. */ 27 const NUM_COLUMNS = 6;24 const NUM_COLUMNS = 8; 28 25 29 26 /** The number of lazy-loaded columns. */ … … 40 37 const TITLE = 'ask_question.TITLE'; 41 38 39 /** the column name for the STRIPPED_TITLE field */ 40 const STRIPPED_TITLE = 'ask_question.STRIPPED_TITLE'; 41 42 42 /** the column name for the BODY field */ 43 43 const BODY = 'ask_question.BODY'; 44 44 45 /** the column name for the INTERESTED_USERS field */ 46 const INTERESTED_USERS = 'ask_question.INTERESTED_USERS'; 47 45 48 /** the column name for the CREATED_AT field */ 46 49 const CREATED_AT = 'ask_question.CREATED_AT'; … … 60 63 */ 61 64 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, ) 66 69 ); 67 70 … … 73 76 */ 74 77 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, ) 79 82 ); 80 83 … … 183 186 $criteria->addSelectColumn(QuestionPeer::TITLE); 184 187 188 $criteria->addSelectColumn(QuestionPeer::STRIPPED_TITLE); 189 185 190 $criteria->addSelectColumn(QuestionPeer::BODY); 191 192 $criteria->addSelectColumn(QuestionPeer::INTERESTED_USERS); 186 193 187 194 $criteria->addSelectColumn(QuestionPeer::CREATED_AT); trunk/lib/model/om/BaseRelevancy.php
r4 r12 4 4 5 5 require_once 'propel/om/Persistent.php'; 6 7 8 include_once 'propel/util/Criteria.php';9 10 include_once 'model/RelevancyPeer.php';11 6 12 7 /** trunk/lib/model/om/BaseRelevancyPeer.php
r4 r12 2 2 3 3 require_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';7 4 8 5 /** trunk/lib/model/om/BaseUser.php
r4 r12 4 4 5 5 require_once 'propel/om/Persistent.php'; 6 7 8 include_once 'propel/util/Criteria.php';9 10 include_once 'model/UserPeer.php';11 6 12 7 /** trunk/lib/model/om/BaseUserPeer.php
r4 r12 2 2 3 3 require_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';7 4 8 5 /**
