Changeset 23
- Timestamp:
- 12/08/05 10:47:03 (7 years ago)
- Files:
-
- trunk/config/schema.xml (modified) (2 diffs)
- trunk/data/fixtures/test_data.yml (modified) (2 diffs)
- trunk/data/sql/schema.sql (modified) (2 diffs)
- trunk/frontend/config/app.yml (modified) (1 diff)
- trunk/frontend/config/routing.yml (modified) (2 diffs)
- trunk/frontend/lib/helper/AnswerHelper.php (modified) (1 diff)
- trunk/frontend/lib/helper/GlobalHelper.php (added)
- trunk/frontend/lib/helper/QuestionHelper.php (modified) (1 diff)
- trunk/frontend/modules/answer/templates/_list.php (modified) (1 diff)
- trunk/frontend/modules/answer/templates/recentSuccess.php (modified) (1 diff)
- trunk/frontend/modules/question/templates/_question_list.php (modified) (2 diffs)
- trunk/frontend/modules/question/templates/showSuccess.php (modified) (1 diff)
- trunk/frontend/modules/sidebar/templates/defaultSuccess.php (modified) (1 diff)
- trunk/frontend/modules/user/actions/actions.class.php (modified) (2 diffs)
- trunk/frontend/modules/user/templates/listInterestedBySuccess.php (modified) (1 diff)
- trunk/frontend/templates/layout.php (modified) (2 diffs)
- trunk/lib/markdown.php (added)
- trunk/lib/model/Answer.php (modified) (1 diff)
- trunk/lib/model/Question.php (modified) (2 diffs)
- trunk/lib/model/UserPeer.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) (11 diffs)
- trunk/lib/model/om/BaseAnswerPeer.php (modified) (5 diffs)
- trunk/lib/model/om/BaseQuestion.php (modified) (11 diffs)
- trunk/lib/model/om/BaseQuestionPeer.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/config/schema.xml
r20 r23 10 10 <column name="stripped_title" type="longvarchar" /> 11 11 <column name="body" type="longvarchar" /> 12 <column name="html_body" type="longvarchar" /> 12 13 <column name="interested_users" type="integer" default="0" /> 13 14 <column name="created_at" type="timestamp" /> … … 26 27 </foreign-key> 27 28 <column name="body" type="longvarchar" /> 29 <column name="html_body" type="longvarchar" /> 28 30 <column name="relevancy_up" type="integer" default="0" /> 29 31 <column name="relevancy_down" type="integer" default="0" /> trunk/data/fixtures/test_data.yml
r16 r23 24 24 user_id: fabien 25 25 body: | 26 We shall meet in front of the __Dunkin'Do ghnuts__ before dinner,26 We shall meet in front of the __Dunkin'Donuts__ before dinner, 27 27 and I haven't the slightest idea of what I can do with her. 28 She's not interested in programming, space opera movies nor insects.29 She's kinda cute, so I reallyneed to find something28 She's not interested in _programming_, _space opera movies_ nor _insects_. 29 She's kinda cute, so I __really__ need to find something 30 30 that will keep her to my side for another evening. 31 31 … … 35 35 body: | 36 36 My stepmother has everything a stepmother is usually offered 37 (watch, vacuum cleaner, earrings, del.icio.usaccount).37 (watch, vacuum cleaner, earrings, [del.icio.us](http://del.icio.us) account). 38 38 Her birthday comes next week, I am broke, and I know that 39 if I don't offer her something sweet, my girlfriend39 if I don't offer her something *sweet*, my girlfriend 40 40 won't look at me in the eyes for another month. 41 41 trunk/data/sql/schema.sql
r20 r23 14 14 `stripped_title` TEXT , 15 15 `body` TEXT , 16 `html_body` TEXT , 16 17 `interested_users` INTEGER default 0 , 17 18 `created_at` DATETIME , … … 34 35 `user_id` INTEGER , 35 36 `body` TEXT , 37 `html_body` TEXT , 36 38 `relevancy_up` INTEGER default 0 , 37 39 `relevancy_down` INTEGER default 0 , trunk/frontend/config/app.yml
r14 r23 4 4 homepage_max: 2 5 5 answers_max: 1 6 users_max: 10 7 trunk/frontend/config/routing.yml
r18 r23 12 12 param: { module: question, action: recent } 13 13 14 add_question: 15 url: /add_question 16 param: { module: question, action: add } 17 14 18 # answers 19 recent_answers: 20 url: /recent/answers 21 param: { module: answer, action: recent } 22 23 add_answer: 24 url: /add_anwser 25 param: { module: answer, action: add } 26 15 27 answers: 16 28 url: /question/:stripped_title/page/:page 17 29 param: { module: question, action: show, page: 1 } 30 31 # user 32 user_interests: 33 url: /question/:stripped_title/interests/:page 34 param: { module: user, action: listInterestedBy } 35 36 user_profile: 37 url: /user/:nickname 38 param: { module: user, action: show } 39 40 current_user_profile: 41 url: /user 42 param: { module: user, action: show } 43 44 add_account: 45 url: /add_user 46 param: { module: user, action: new } 18 47 19 48 # login … … 21 50 url: /login 22 51 param: { module: user, action: login } 52 53 logout: 54 url: /logout 55 param: { module: user, action: logout } 23 56 24 57 # default rules trunk/frontend/lib/helper/AnswerHelper.php
r20 r23 3 3 function answer_pager_link($name, $question, $page) 4 4 { 5 return link_to($name, ' question/show?stripped_title='.$question->getStrippedTitle().'&page='.$page);5 return link_to($name, '@question?stripped_title='.$question->getStrippedTitle().'&page='.$page); 6 6 } 7 7 trunk/frontend/lib/helper/QuestionHelper.php
r14 r23 1 1 <?php 2 2 3 function question_pager_link($name, $page)4 {5 return link_to($name, 'question/list?page='.$page);6 }7 8 3 ?> trunk/frontend/modules/answer/templates/_list.php
r20 r23 10 10 on <?php echo format_date($answer->getCreatedAt(), 'p') ?> 11 11 <div> 12 <?php echo $answer->get Body() ?>12 <?php echo $answer->getHtmlBody() ?> 13 13 </div> 14 14 </div> trunk/frontend/modules/answer/templates/recentSuccess.php
r18 r23 8 8 <div id="answers_pager"> 9 9 10 <?php echo link_to('«', ' answer/recent?page=1') ?>11 <?php echo link_to('<', ' answer/recent?page='.$answer_pager->getPreviousPage()) ?>10 <?php echo link_to('«', '@recent_answers?page=1') ?> 11 <?php echo link_to('<', '@recent_answers?page='.$answer_pager->getPreviousPage()) ?> 12 12 13 13 <?php foreach ($answer_pager->getLinks() as $page): ?> 14 <?php echo ($page == $answer_pager->getPage()) ? $page : link_to($page, ' answer/recent?page='.$page) ?>14 <?php echo ($page == $answer_pager->getPage()) ? $page : link_to($page, '@recent_answers?page='.$page) ?> 15 15 <?php echo ($page != $answer_pager->getCurrentMaxLink()) ? '-' : '' ?> 16 16 <?php endforeach ?> 17 17 18 <?php echo link_to('>', ' answer/recent?page='.$answer_pager->getNextPage()) ?>19 <?php echo link_to('»', ' answer/recent?page='.$answer_pager->getLastPage()) ?>18 <?php echo link_to('>', '@recent_answers?page='.$answer_pager->getNextPage()) ?> 19 <?php echo link_to('»', '@recent_answers?page='.$answer_pager->getLastPage()) ?> 20 20 21 21 </div> trunk/frontend/modules/question/templates/_question_list.php
r20 r23 1 <?php use_helpers('Text', ' Question') ?>1 <?php use_helpers('Text', 'Global') ?> 2 2 3 3 <?php foreach($question_pager->getResults() as $question): ?> … … 6 6 </div> 7 7 8 <h2><?php echo link_to($question->getTitle(), ' question/show?stripped_title='.$question->getStrippedTitle()) ?></h2>8 <h2><?php echo link_to($question->getTitle(), '@question?stripped_title='.$question->getStrippedTitle()) ?></h2> 9 9 10 10 <div class="question_body"> 11 <?php echo truncate_text( $question->getBody(), 200) ?>11 <?php echo truncate_text(strip_tags($question->getHtmlBody()), 200) ?> 12 12 </div> 13 13 <?php endforeach ?> 14 14 15 15 <div id="question_pager"> 16 <?php if ($question_pager->haveToPaginate()): ?> 17 <?php echo question_pager_link('«', 1) ?> 18 <?php echo question_pager_link('<', $question_pager->getPreviousPage()) ?> 19 20 <?php foreach ($question_pager->getLinks() as $page): ?> 21 <?php echo link_to_unless($page == $question_pager->getPage(), $page, 'question/list?page='.$page) ?> 22 <?php echo ($page != $question_pager->getCurrentMaxLink()) ? '-' : '' ?> 23 <?php endforeach ?> 24 25 <?php echo question_pager_link('>', $question_pager->getNextPage()) ?> 26 <?php echo question_pager_link('»', $question_pager->getLastPage()) ?> 27 <?php endif ?> 16 <?php echo pager_navigation($question_pager, '@popular_questions') ?> 28 17 </div> trunk/frontend/modules/question/templates/showSuccess.php
r18 r23 8 8 9 9 <div class="question_body"> 10 <?php echo $question->get Body() ?>10 <?php echo $question->getHtmlBody() ?> 11 11 </div> 12 12 trunk/frontend/modules/sidebar/templates/defaultSuccess.php
r18 r23 1 <?php echo link_to('ask a new question', ' question/new') ?>1 <?php echo link_to('ask a new question', '@add_question') ?> 2 2 3 3 <ul> 4 <li><?php echo link_to('popular questions', ' question/list') ?>5 <li><?php echo link_to('latest questions', ' question/recent') ?></li>6 <li><?php echo link_to('latest answers', ' answer/recent') ?></li>4 <li><?php echo link_to('popular questions', '@homepage') ?> 5 <li><?php echo link_to('latest questions', '@recent_questions') ?></li> 6 <li><?php echo link_to('latest answers', '@recent_answers') ?></li> 7 7 </ul> trunk/frontend/modules/user/actions/actions.class.php
r20 r23 13 13 public function executeListInterestedBy() 14 14 { 15 $this->question = QuestionPeer:: retrieveByPk($this->getRequestParameter('id'));15 $this->question = QuestionPeer::getQuestionFromTitle($this->getRequestParameter('stripped_title')); 16 16 $this->forward404Unless($this->question instanceof Question); 17 17 18 $this->interested_users = $this->question->getAllInterestedUsers(); 18 $page = $this->getRequestParameter('page', 1); 19 20 $this->interested_users_pager = $this->question->getInterestedUsersPager($page); 19 21 } 20 22 … … 48 50 public function executeShow() 49 51 { 50 $this->subscriber = UserPeer::retrieveByPk($this->getRequestParameter('id', $this->getUser()->getSubscriberId())); 52 if ($this->hasRequestParameter('nickname')) 53 { 54 $this->subscriber = UserPeer::getUserFromNickname($this->getRequestParameter('nickname')); 55 } 56 else 57 { 58 $this->subscriber = UserPeer::retrieveByPk($this->getUser()->getSubscriberId()); 59 } 51 60 $this->forward404Unless($this->subscriber); 52 61 trunk/frontend/modules/user/templates/listInterestedBySuccess.php
r18 r23 1 <?php use_helper ('Date') ?>1 <?php use_helpers('Date', 'Global') ?> 2 2 3 <h 1><?php echo $question->getTitle() ?></h1>3 <h2><?php echo $question->getTitle() ?></h2> 4 4 <p>asked by <strong><?php echo $question->getUser() ?></strong> <?php echo time_ago_in_words($question->getCreatedAt('U')) ?> ago</p> 5 6 <?php echo count($interested_users) ?> askeet users are interested by this question5 6 <?php echo $interested_users_pager->getNbResults() ?> askeet users are interested by this question 7 7 <ul> 8 <?php foreach ($interested_users as $interested_user): ?>9 <li><?php echo link_to($interested_user->__toString(), ' user/show?id='.$interested_user->getId()) ?></li>8 <?php foreach ($interested_users_pager->getResults() as $interested_user): ?> 9 <li><?php echo link_to($interested_user->__toString(), '@user_profile?nickname='.$interested_user->getNickname()) ?></li> 10 10 <?php endforeach ?> 11 11 </ul> 12 13 <div id="users_pager"> 14 <?php echo pager_navigation($interested_users_pager, '@user_interests?stripped_title='.$request->getParameter('stripped_title 15 ')) ?> 16 </div> trunk/frontend/templates/layout.php
r21 r23 23 23 <ul> 24 24 <?php if ($user->hasAttribute('nickname', 'subscriber')): ?> 25 <li><?php echo link_to('sign out', ' user/logout') ?></li>26 <li><?php echo link_to($user->getAttribute('nickname', '', 'subscriber').' profile', ' user/profile') ?></li>25 <li><?php echo link_to('sign out', '@logout') ?></li> 26 <li><?php echo link_to($user->getAttribute('nickname', '', 'subscriber').' profile', '@current_user_profile') ?></li> 27 27 <?php else: ?> 28 <li><?php echo link_to('sign in/register', ' user/login') ?></li>28 <li><?php echo link_to('sign in/register', '@login') ?></li> 29 29 <?php endif ?> 30 30 <li><?php echo link_to('about', 'question/list') ?></li> 31 31 </ul> 32 <h1><?php echo link_to(image_tag('askeet_logo.gif', 'alt=askeet'), ' question/list') ?></h1>32 <h1><?php echo link_to(image_tag('askeet_logo.gif', 'alt=askeet'), '@homepage') ?></h1> 33 33 </div> 34 35 <?php echo link_to_function('cancel', visual_effect('blind_up', 'login', array('duration' => 0.5))) ?>36 34 37 35 <div id="login" style="display: none"> … … 40 38 <?php echo link_to_function('cancel', visual_effect('blind_up', 'login', array('duration' => 0.5))) ?> 41 39 42 <?php echo form_tag(' user/login', 'id=loginform') ?>40 <?php echo form_tag('@login', 'id=loginform') ?> 43 41 nickname: <?php echo input_tag('nickname') ?><br /> 44 42 password: <?php echo input_password_tag('password') ?><br /> trunk/lib/model/Answer.php
r20 r23 30 30 return $total ? sprintf('%.0f', $this->getRelevancyDown() * 100 / $total) : 0; 31 31 } 32 33 public function setBody($v) 34 { 35 parent::setBody($v); 36 37 require_once('markdown.php'); 38 39 $this->setHtmlBody(markdown($v)); 40 } 32 41 } 33 42 trunk/lib/model/Question.php
r18 r23 24 24 } 25 25 26 public function setBody($v) 27 { 28 parent::setBody($v); 29 30 require_once('markdown.php'); 31 32 $this->setHtmlBody(markdown($v)); 33 } 34 26 35 public function getAllInterestedUsers() 27 { 36 { 28 37 $c = new Criteria(); 29 38 $c->addJoin(UserPeer::ID, InterestPeer::USER_ID, Criteria::LEFT_JOIN); … … 32 41 return UserPeer::doSelect($c); 33 42 } 43 44 public function getInterestedUsersPager($page) 45 { 46 $c = new Criteria(); 47 $c->addJoin(UserPeer::ID, InterestPeer::USER_ID, Criteria::LEFT_JOIN); 48 $c->add(InterestPeer::QUESTION_ID, $this->getId()); 49 50 $pager = new sfPager('User', APP_PAGER_USERS_MAX); 51 $pager->setCriteria($c); 52 $pager->setPage($page); 53 $pager->init(); 54 55 return $pager; 56 } 34 57 } 35 58 trunk/lib/model/UserPeer.php
r4 r23 19 19 * @package model 20 20 */ 21 class UserPeer extends BaseUserPeer { 21 class UserPeer extends BaseUserPeer 22 { 23 public static function getUserFromNickname($nickname) 24 { 25 $c = new Criteria(); 26 $c->add(self::NICKNAME, $nickname); 22 27 23 } // UserPeer 28 return self::doSelectOne($c); 29 } 30 } 31 32 ?> trunk/lib/model/map/AnswerMapBuilder.php
r12 r23 73 73 $tMap->addColumn('BODY', 'Body', 'string', CreoleTypes::LONGVARCHAR, false); 74 74 75 $tMap->addColumn('HTML_BODY', 'HtmlBody', 'string', CreoleTypes::LONGVARCHAR, false); 76 75 77 $tMap->addColumn('RELEVANCY_UP', 'RelevancyUp', 'int', CreoleTypes::INTEGER, false); 76 78 trunk/lib/model/map/QuestionMapBuilder.php
r12 r23 75 75 $tMap->addColumn('BODY', 'Body', 'string', CreoleTypes::LONGVARCHAR, false); 76 76 77 $tMap->addColumn('HTML_BODY', 'HtmlBody', 'string', CreoleTypes::LONGVARCHAR, false); 78 77 79 $tMap->addColumn('INTERESTED_USERS', 'InterestedUsers', 'int', CreoleTypes::INTEGER, false); 78 80 trunk/lib/model/om/BaseAnswer.php
r16 r23 58 58 59 59 /** 60 * The value for the html_body field. 61 * @var string 62 */ 63 protected $html_body; 64 65 66 /** 60 67 * The value for the relevancy_up field. 61 68 * @var int … … 155 162 156 163 return $this->body; 164 } 165 166 /** 167 * Get the [html_body] column value. 168 * 169 * @return string 170 */ 171 public function getHtmlBody() 172 { 173 174 return $this->html_body; 157 175 } 158 176 … … 283 301 284 302 /** 303 * Set the value of [html_body] column. 304 * 305 * @param string $v new value 306 * @return void 307 */ 308 public function setHtmlBody($v) 309 { 310 311 if ($this->html_body !== $v) { 312 $this->html_body = $v; 313 $this->modifiedColumns[] = AnswerPeer::HTML_BODY; 314 } 315 316 } // setHtmlBody() 317 318 /** 285 319 * Set the value of [relevancy_up] column. 286 320 * … … 363 397 $this->body = $rs->getString($startcol + 3); 364 398 365 $this->relevancy_up = $rs->getInt($startcol + 4); 366 367 $this->relevancy_down = $rs->getInt($startcol + 5); 368 369 $this->created_at = $rs->getTimestamp($startcol + 6, null); 399 $this->html_body = $rs->getString($startcol + 4); 400 401 $this->relevancy_up = $rs->getInt($startcol + 5); 402 403 $this->relevancy_down = $rs->getInt($startcol + 6); 404 405 $this->created_at = $rs->getTimestamp($startcol + 7, null); 370 406 371 407 $this->resetModified(); … … 374 410 375 411 // FIXME - using NUM_COLUMNS may be clearer. 376 return $startcol + 7; // 7= AnswerPeer::NUM_COLUMNS - AnswerPeer::NUM_LAZY_LOAD_COLUMNS).412 return $startcol + 8; // 8 = AnswerPeer::NUM_COLUMNS - AnswerPeer::NUM_LAZY_LOAD_COLUMNS). 377 413 378 414 } catch (Exception $e) { … … 630 666 break; 631 667 case 4: 668 return $this->getHtmlBody(); 669 break; 670 case 5: 632 671 return $this->getRelevancyUp(); 633 672 break; 634 case 5:673 case 6: 635 674 return $this->getRelevancyDown(); 636 675 break; 637 case 6:676 case 7: 638 677 return $this->getCreatedAt(); 639 678 break; … … 662 701 $keys[2] => $this->getUserId(), 663 702 $keys[3] => $this->getBody(), 664 $keys[4] => $this->getRelevancyUp(), 665 $keys[5] => $this->getRelevancyDown(), 666 $keys[6] => $this->getCreatedAt(), 703 $keys[4] => $this->getHtmlBody(), 704 $keys[5] => $this->getRelevancyUp(), 705 $keys[6] => $this->getRelevancyDown(), 706 $keys[7] => $this->getCreatedAt(), 667 707 ); 668 708 return $result; … … 710 750 break; 711 751 case 4: 752 $this->setHtmlBody($value); 753 break; 754 case 5: 712 755 $this->setRelevancyUp($value); 713 756 break; 714 case 5:757 case 6: 715 758 $this->setRelevancyDown($value); 716 759 break; 717 case 6:760 case 7: 718 761 $this->setCreatedAt($value); 719 762 break; … … 745 788 if (array_key_exists($keys[2], $arr)) $this->setUserId($arr[$keys[2]]); 746 789 if (array_key_exists($keys[3], $arr)) $this->setBody($arr[$keys[3]]); 747 if (array_key_exists($keys[4], $arr)) $this->setRelevancyUp($arr[$keys[4]]); 748 if (array_key_exists($keys[5], $arr)) $this->setRelevancyDown($arr[$keys[5]]); 749 if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]); 790 if (array_key_exists($keys[4], $arr)) $this->setHtmlBody($arr[$keys[4]]); 791 if (array_key_exists($keys[5], $arr)) $this->setRelevancyUp($arr[$keys[5]]); 792 if (array_key_exists($keys[6], $arr)) $this->setRelevancyDown($arr[$keys[6]]); 793 if (array_key_exists($keys[7], $arr)) $this->setCreatedAt($arr[$keys[7]]); 750 794 } 751 795 … … 763 807 if ($this->isColumnModified(AnswerPeer::USER_ID)) $criteria->add(AnswerPeer::USER_ID, $this->user_id); 764 808 if ($this->isColumnModified(AnswerPeer::BODY)) $criteria->add(AnswerPeer::BODY, $this->body); 809 if ($this->isColumnModified(AnswerPeer::HTML_BODY)) $criteria->add(AnswerPeer::HTML_BODY, $this->html_body); 765 810 if ($this->isColumnModified(AnswerPeer::RELEVANCY_UP)) $criteria->add(AnswerPeer::RELEVANCY_UP, $this->relevancy_up); 766 811 if ($this->isColumnModified(AnswerPeer::RELEVANCY_DOWN)) $criteria->add(AnswerPeer::RELEVANCY_DOWN, $this->relevancy_down); … … 825 870 826 871 $copyObj->setBody($this->body); 872 873 $copyObj->setHtmlBody($this->html_body); 827 874 828 875 $copyObj->setRelevancyUp($this->relevancy_up); trunk/lib/model/om/BaseAnswerPeer.php
r16 r23 25 25 26 26 /** The total number of columns. */ 27 const NUM_COLUMNS = 7;27 const NUM_COLUMNS = 8; 28 28 29 29 /** The number of lazy-loaded columns. */ … … 43 43 const BODY = 'ask_answer.BODY'; 44 44 45 /** the column name for the HTML_BODY field */ 46 const HTML_BODY = 'ask_answer.HTML_BODY'; 47 45 48 /** the column name for the RELEVANCY_UP field */ 46 49 const RELEVANCY_UP = 'ask_answer.RELEVANCY_UP'; … … 63 66 */ 64 67 private static $fieldNames = array ( 65 BasePeer::TYPE_PHPNAME => array ('Id', 'QuestionId', 'UserId', 'Body', ' RelevancyUp', 'RelevancyDown', 'CreatedAt', ),66 BasePeer::TYPE_COLNAME => array (AnswerPeer::ID, AnswerPeer::QUESTION_ID, AnswerPeer::USER_ID, AnswerPeer::BODY, AnswerPeer:: RELEVANCY_UP, AnswerPeer::RELEVANCY_DOWN, AnswerPeer::CREATED_AT, ),67 BasePeer::TYPE_FIELDNAME => array ('id', 'question_id', 'user_id', 'body', ' relevancy_up', 'relevancy_down', 'created_at', ),68 BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )68 BasePeer::TYPE_PHPNAME => array ('Id', 'QuestionId', 'UserId', 'Body', 'HtmlBody', 'RelevancyUp', 'RelevancyDown', 'CreatedAt', ), 69 BasePeer::TYPE_COLNAME => array (AnswerPeer::ID, AnswerPeer::QUESTION_ID, AnswerPeer::USER_ID, AnswerPeer::BODY, AnswerPeer::HTML_BODY, AnswerPeer::RELEVANCY_UP, AnswerPeer::RELEVANCY_DOWN, AnswerPeer::CREATED_AT, ), 70 BasePeer::TYPE_FIELDNAME => array ('id', 'question_id', 'user_id', 'body', 'html_body', 'relevancy_up', 'relevancy_down', 'created_at', ), 71 BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) 69 72 ); 70 73 … … 76 79 */ 77 80 private static $fieldKeys = array ( 78 BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'QuestionId' => 1, 'UserId' => 2, 'Body' => 3, ' RelevancyUp' => 4, 'RelevancyDown' => 5, 'CreatedAt' => 6, ),79 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, ),80 BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'question_id' => 1, 'user_id' => 2, 'body' => 3, ' relevancy_up' => 4, 'relevancy_down' => 5, 'created_at' => 6, ),81 BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )81 BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'QuestionId' => 1, 'UserId' => 2, 'Body' => 3, 'HtmlBody' => 4, 'RelevancyUp' => 5, 'RelevancyDown' => 6, 'CreatedAt' => 7, ), 82 BasePeer::TYPE_COLNAME => array (AnswerPeer::ID => 0, AnswerPeer::QUESTION_ID => 1, AnswerPeer::USER_ID => 2, AnswerPeer::BODY => 3, AnswerPeer::HTML_BODY => 4, AnswerPeer::RELEVANCY_UP => 5, AnswerPeer::RELEVANCY_DOWN => 6, AnswerPeer::CREATED_AT => 7, ), 83 BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'question_id' => 1, 'user_id' => 2, 'body' => 3, 'html_body' => 4, 'relevancy_up' => 5, 'relevancy_down' => 6, 'created_at' => 7, ), 84 BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) 82 85 ); 83 86 … … 187 190 188 191 $criteria->addSelectColumn(AnswerPeer::BODY); 192 193 $criteria->addSelectColumn(AnswerPeer::HTML_BODY); 189 194 190 195 $criteria->addSelectColumn(AnswerPeer::RELEVANCY_UP); trunk/lib/model/om/BaseQuestion.php
r16 r23 65 65 66 66 /** 67 * The value for the html_body field. 68 * @var string 69 */ 70 protected $html_body; 71 72 73 /** 67 74 * The value for the interested_users field. 68 75 * @var int … … 180 187 181 188 return $this->body; 189 } 190 191 /** 192 * Get the [html_body] column value. 193 * 194 * @return string 195 */ 196 public function getHtmlBody() 197 { 198 199 return $this->html_body; 182 200 } 183 201 … … 340 358 341 359 /** 360 * Set the value of [html_body] column. 361 * 362 * @param string $v new value 363 * @return void 364 */ 365 public function setHtmlBody($v) 366 { 367 368 if ($this->html_body !== $v) { 369 $this->html_body = $v; 370 $this->modifiedColumns[] = QuestionPeer::HTML_BODY; 371 } 372 373 } // setHtmlBody() 374 375 /** 342 376 * Set the value of [interested_users] column. 343 377 * … … 430 464 $this->body = $rs->getString($startcol + 4); 431 465 432 $this->interested_users = $rs->getInt($startcol + 5); 433 434 $this->created_at = $rs->getTimestamp($startcol + 6, null); 435 436 $this->updated_at = $rs->getTimestamp($startcol + 7, null); 466 $this->html_body = $rs->getString($startcol + 5); 467 468 $this->interested_users = $rs->getInt($startcol + 6); 469 470 $this->created_at = $rs->getTimestamp($startcol + 7, null); 471 472 $this->updated_at = $rs->getTimestamp($startcol + 8, null); 437 473 438 474 $this->resetModified(); … … 441 477 442 478 // FIXME - using NUM_COLUMNS may be clearer. 443 return $startcol + 8; // 8= QuestionPeer::NUM_COLUMNS - QuestionPeer::NUM_LAZY_LOAD_COLUMNS).479 return $startcol + 9; // 9 = QuestionPeer::NUM_COLUMNS - QuestionPeer::NUM_LAZY_LOAD_COLUMNS). 444 480 445 481 } catch (Exception $e) { … … 704 740 break; 705 741 case 5: 742 return $this->getHtmlBody(); 743 break; 744 case 6: 706 745 return $this->getInterestedUsers(); 707 746 break; 708 case 6:747 case 7: 709 748 return $this->getCreatedAt(); 710 749 break; 711 case 7:750 case 8: 712 751 return $this->getUpdatedAt(); 713 752 break; … … 737 776 $keys[3] => $this->getStrippedTitle(), 738 777 $keys[4] => $this->getBody(), 739 $keys[5] => $this->getInterestedUsers(), 740 $keys[6] => $this->getCreatedAt(), 741 $keys[7] => $this->getUpdatedAt(), 778 $keys[5] => $this->getHtmlBody(), 779 $keys[6] => $this->getInterestedUsers(), 780 $keys[7] => $this->getCreatedAt(), 781 $keys[8] => $this->getUpdatedAt(), 742 782 ); 743 783 return $result; … … 788 828 break; 789 829 case 5: 830 $this->setHtmlBody($value); 831 break; 832 case 6: 790 833 $this->setInterestedUsers($value); 791 834 break; 792 case 6:835 case 7: 793 836 $this->setCreatedAt($value); 794 837 break; 795 case 7:838 case 8: 796 839 $this->setUpdatedAt($value); 797 840 break; … … 824 867 if (array_key_exists($keys[3], $arr)) $this->setStrippedTitle($arr[$keys[3]]); 825 868 if (array_key_exists($keys[4], $arr)) $this->setBody($arr[$keys[4]]); 826 if (array_key_exists($keys[5], $arr)) $this->setInterestedUsers($arr[$keys[5]]); 827 if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]); 828 if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]); 869 if (array_key_exists($keys[5], $arr)) $this->setHtmlBody($arr[$keys[5]]); 870 if (array_key_exists($keys[6], $arr)) $this->setInterestedUsers($arr[$keys[6]]); 871 if (array_key_exists($keys[7], $arr)) $this->setCreatedAt($arr[$keys[7]]); 872 if (array_key_exists($keys[8], $arr)) $this->setUpdatedAt($arr[$keys[8]]); 829 873 } 830 874 … … 843 887 if ($this->isColumnModified(QuestionPeer::STRIPPED_TITLE)) $criteria->add(QuestionPeer::STRIPPED_TITLE, $this->stripped_title); 844 888 if ($this->isColumnModified(QuestionPeer::BODY)) $criteria->add(QuestionPeer::BODY, $this->body); 889 if ($this->isColumnModified(QuestionPeer::HTML_BODY)) $criteria->add(QuestionPeer::HTML_BODY, $this->html_body); 845 890 if ($this->isColumnModified(QuestionPeer::INTERESTED_USERS)) $criteria->add(QuestionPeer::INTERESTED_USERS, $this->interested_users); 846 891 if ($this->isColumnModified(QuestionPeer::CREATED_AT)) $criteria->add(QuestionPeer::CREATED_AT, $this->created_at); … … 907 952 908 953 $copyObj->setBody($this->body); 954 955 $copyObj->setHtmlBody($this->html_body); 909 956 910 957 $copyObj->setInterestedUsers($this->interested_users); trunk/lib/model/om/BaseQuestionPeer.php
r16 r23 25 25 26 26 /** The total number of columns. */ 27 const NUM_COLUMNS = 8;27 const NUM_COLUMNS = 9; 28 28 29 29 /** The number of lazy-loaded columns. */ … … 46 46 const BODY = 'ask_question.BODY'; 47 47 48 /** the column name for the HTML_BODY field */ 49 const HTML_BODY = 'ask_question.HTML_BODY'; 50 48 51 /** the column name for the INTERESTED_USERS field */ 49 52 const INTERESTED_USERS = 'ask_question.INTERESTED_USERS'; … … 66 69 */ 67 70 private static $fieldNames = array ( 68 BasePeer::TYPE_PHPNAME => array ('Id', 'UserId', 'Title', 'StrippedTitle', 'Body', ' InterestedUsers', 'CreatedAt', 'UpdatedAt', ),69 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, ),70 BasePeer::TYPE_FIELDNAME => array ('id', 'user_id', 'title', 'stripped_title', 'body', ' interested_users', 'created_at', 'updated_at', ),71 BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )71 BasePeer::TYPE_PHPNAME => array ('Id', 'UserId', 'Title', 'StrippedTitle', 'Body', 'HtmlBody', 'InterestedUsers', 'CreatedAt', 'UpdatedAt', ), 72 BasePeer::TYPE_COLNAME => array (QuestionPeer::ID, QuestionPeer::USER_ID, QuestionPeer::TITLE, QuestionPeer::STRIPPED_TITLE, QuestionPeer::BODY, QuestionPeer::HTML_BODY, QuestionPeer::INTERESTED_USERS, QuestionPeer::CREATED_AT, QuestionPeer::UPDATED_AT, ), 73 BasePeer::TYPE_FIELDNAME => array ('id', 'user_id', 'title', 'stripped_title', 'body', 'html_body', 'interested_users', 'created_at', 'updated_at', ), 74 BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, ) 72 75 ); 73 76 … … 79 82 */ 80 83 private static $fieldKeys = array ( 81 BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'UserId' => 1, 'Title' => 2, 'StrippedTitle' => 3, 'Body' => 4, ' InterestedUsers' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ),82 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, ),83 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, ),84 BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )84 BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'UserId' => 1, 'Title' => 2, 'StrippedTitle' => 3, 'Body' => 4, 'HtmlBody' => 5, 'InterestedUsers' => 6, 'CreatedAt' => 7, 'UpdatedAt' => 8, ), 85 BasePeer::TYPE_COLNAME => array (QuestionPeer::ID => 0, QuestionPeer::USER_ID => 1, QuestionPeer::TITLE => 2, QuestionPeer::STRIPPED_TITLE => 3, QuestionPeer::BODY => 4, QuestionPeer::HTML_BODY => 5, QuestionPeer::INTERESTED_USERS => 6, QuestionPeer::CREATED_AT => 7, QuestionPeer::UPDATED_AT => 8, ), 86 BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'user_id' => 1, 'title' => 2, 'stripped_title' => 3, 'body' => 4, 'html_body' => 5, 'interested_users' => 6, 'created_at' => 7, 'updated_at' => 8, ), 87 BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, ) 85 88 ); 86 89 … … 192 195 193 196 $criteria->addSelectColumn(QuestionPeer::BODY); 197 198 $criteria->addSelectColumn(QuestionPeer::HTML_BODY); 194 199 195 200 $criteria->addSelectColumn(QuestionPeer::INTERESTED_USERS);
