Changeset 88

Show
Ignore:
Timestamp:
11/29/06 16:05:09 (6 years ago)
Author:
fabien
Message:

updated to symfony 1.0 beta 1

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/SYMFONY

    r2 r88  
     1#!/usr/bin/env php 
     2<?php 
     3 
     4/* 
     5 * This file is part of the symfony package. 
     6 * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com> 
     7 *  
     8 * For the full copyright and license information, please view the LICENSE 
     9 * file that was distributed with this source code. 
     10 */ 
     11 
     12chdir(dirname(__FILE__)); 
     13include('config/config.php'); 
     14include($sf_symfony_data_dir.'/bin/symfony.php'); 
  • trunk/apps/frontend/config/cache.yml

    r2 r88  
    11default: 
    2   activate:  off 
    3   type:      slot 
     2  enabled:   off 
     3  with_layout: false 
    44  lifetime:  86400 
  • trunk/apps/frontend/config/config.php

    r71 r88  
    11<?php 
    22 
    3 // symfony directories 
    4 if (is_readable(SF_ROOT_DIR.'/lib/symfony/symfony.php')) 
    5 
    6   // symlink exists 
    7   $sf_symfony_lib_dir  = SF_ROOT_DIR.'/lib/symfony'; 
    8   $sf_symfony_data_dir = SF_ROOT_DIR.'/data/symfony'; 
    9   $sf_version          = '@DEV@'; 
    10 
    11 else 
    12 
    13   // PEAR config 
    14   if ((include('symfony/pear.php')) != 'OK') 
    15   { 
    16     throw new Exception('Unable to find symfony librairies'); 
    17   } 
    18 
     3// include project configuration 
     4include(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php'); 
    195 
    20 require_once($sf_symfony_lib_dir.'/config/sfConfig.class.php'); 
    21  
    22 sfConfig::add(array( 
    23   'sf_root_dir'         => SF_ROOT_DIR, 
    24   'sf_app'              => SF_APP, 
    25   'sf_environment'      => SF_ENVIRONMENT, 
    26   'sf_debug'            => SF_DEBUG, 
    27   'sf_symfony_lib_dir'  => $sf_symfony_lib_dir, 
    28   'sf_symfony_data_dir' => $sf_symfony_data_dir, 
    29   'sf_test'             => false, 
    30   'sf_version'          => $sf_version, 
    31 )); 
    32  
    33 // start timer 
    34 if (sfConfig::get('sf_debug')) 
    35 
    36   sfConfig::set('sf_timer_start', microtime(true)); 
    37 
    38  
    39 // directory layout 
    40 include($sf_symfony_data_dir.'/config/constants.php'); 
    41  
    42 // include path 
    43 set_include_path( 
    44   sfConfig::get('sf_lib_dir').PATH_SEPARATOR. 
    45   sfConfig::get('sf_app_lib_dir').PATH_SEPARATOR. 
    46   sfConfig::get('sf_symfony_lib_dir').DIRECTORY_SEPARATOR.'vendor'.PATH_SEPARATOR. 
    47   get_include_path() 
    48 ); 
    49  
    50 // check to see if we're not in a cache cleaning process 
    51 require_once(sfConfig::get('sf_symfony_lib_dir').'/util/sfToolkit.class.php'); 
    52 if (sfToolkit::hasLockFile(SF_ROOT_DIR.DIRECTORY_SEPARATOR.SF_APP.'_'.SF_ENVIRONMENT.'.lck', 5)) 
    53 
    54   // application is not yet available 
    55   include(SF_WEB_DIR.'/unavailable.html'); 
    56   die(1); 
    57 
    58  
    59 // require project configuration 
    60 require_once(sfConfig::get('sf_config_dir').'/config.php'); 
    61  
    62 // recent symfony update? 
    63 $version = @file_get_contents(sfConfig::get('sf_config_cache_dir').'/VERSION'); 
    64 if ($version != $sf_version) 
    65 
    66   // force cache regeneration 
    67   foreach (array(sfConfig::get('sf_config_cache_dir').'/config_bootstrap_compile.yml.php', sfConfig::get('sf_config_cache_dir').'/config_core_compile.yml.php') as $file) 
    68   { 
    69     if (is_readable($file)) 
    70     { 
    71       unlink($file); 
    72     } 
    73   } 
    74 
    75  
    76 // go 
    77 $bootstrap = sfConfig::get('sf_config_cache_dir').'/config_bootstrap_compile.yml.php'; 
    78 if (is_readable($bootstrap)) 
    79 
    80   require_once($bootstrap); 
    81 
    82 else 
    83 
    84   require_once(sfConfig::get('sf_symfony_lib_dir').'/symfony.php'); 
    85 
    86  
    87 ?> 
     6// symfony bootstraping 
     7require_once($sf_symfony_lib_dir.'/util/sfCore.class.php'); 
     8sfCore::bootstrap($sf_symfony_lib_dir, $sf_symfony_data_dir); 
  • trunk/apps/frontend/config/filters.yml

    r49 r88  
     1rendering: ~ 
     2web_debug: ~ 
     3security:  ~ 
     4 
     5# generally, you will want to insert your own filters here 
    16myTagFilter: 
    27  class: myTagFilter 
    38  param: 
    49    host_exclude_regex: /^(www|askeet)/ 
     10 
     11 
     12cache:     ~ 
     13common:    ~ 
     14flash:     ~ 
     15execution: ~ 
  • trunk/apps/frontend/config/logging.yml

    r71 r88  
    77 
    88all: 
    9 active: on 
     9enabled: on 
    1010#  level:  debug 
  • trunk/apps/frontend/config/view.yml

    r76 r88  
    1212  stylesheets:    [main, layout] 
    1313 
    14   javascripts:    [/sf/js/prototype/prototype.js] 
     14  javascripts:    [%SF_PROTOTYPE_WEB_DIR%/js/prototype.js] 
    1515 
    1616  has_layout:     on 
  • trunk/apps/frontend/lib/helper/UserHelper.php

    r64 r88  
    11<?php 
    22 
    3 use_helpers('Javascript', 'Global'); 
     3use_helper('Javascript', 'Global'); 
    44 
    55function link_to_user_interested($user, $question) 
  • trunk/apps/frontend/modules/answer/templates/_answer.php

    r69 r88  
    1 <?php use_helpers('Date', 'User') ?> 
     1<?php use_helper('Date', 'User') ?> 
    22 
    33<div class="vote_block" id="vote_<?php echo $answer->getId() ?>"> 
  • trunk/apps/frontend/modules/answer/templates/recentSuccess.php

    r80 r88  
    1 <?php use_helpers('Date', 'Answer', 'Question') ?> 
     1<?php use_helper('Date', 'Answer', 'Question') ?> 
    22 
    33<h1><?php echo __('recent answers') ?></h1> 
  • trunk/apps/frontend/modules/moderator/templates/reportedAnswersSuccess.php

    r74 r88  
    1 <?php use_helpers('Date', 'User', 'Global', 'Question') ?> 
     1<?php use_helper('Date', 'User', 'Global', 'Question') ?> 
    22 
    33<h1><?php echo __('answers reported as spam') ?></h1> 
  • trunk/apps/frontend/modules/moderator/templates/reportedQuestionsSuccess.php

    r74 r88  
    1 <?php use_helpers('Text', 'Global', 'Question', 'Date', 'User') ?> 
     1<?php use_helper('Text', 'Global', 'Question', 'Date', 'User') ?> 
    22 
    33<h1><?php echo __('questions reported as spam') ?></h1> 
  • trunk/apps/frontend/modules/question/templates/_question_block.php

    r69 r88  
    1 <?php use_helpers('Text', 'Global', 'Question', 'Date') ?> 
     1<?php use_helper('Text', 'Global', 'Question', 'Date') ?> 
    22 
    33<div class="question"> 
  • trunk/apps/frontend/modules/question/templates/_question_list.php

    r79 r88  
    1 <?php use_helpers('Global') ?> 
     1<?php use_helper('Global') ?> 
    22 
    33<?php foreach($question_pager->getResults() as $question): ?> 
  • trunk/apps/frontend/modules/question/templates/addSuccess.php

    r69 r88  
    1 <?php use_helper('Javascript') ?> 
     1<?php use_helper('Javascript', 'Validation') ?> 
    22 
    33<h1><?php echo __('ask a question') ?></h1> 
  • trunk/apps/frontend/modules/question/templates/searchSuccess.php

    r69 r88  
    1 <?php use_helpers('Global') ?> 
     1<?php use_helper('Global') ?> 
    22 
    33<h1><?php echo __('questions matching "%1%"', array('%1%' => htmlspecialchars($sf_params->get('search')))) ?></h1> 
  • trunk/apps/frontend/modules/question/templates/showSuccess.php

    r69 r88  
    1 <?php use_helpers('Date', 'Answer', 'Question') ?> 
     1<?php use_helper('Date', 'Answer', 'Question') ?> 
    22 
    33<h1></h1> 
  • trunk/apps/frontend/modules/tag/config/cache.yml

    r53 r88  
    11popular: 
    2   activate:   on 
    3   type:       slot 
     2  enabled:    on 
     3  with_layout: false 
    44 
    55all: 
  • trunk/apps/frontend/modules/user/templates/listInterestedBySuccess.php

    r69 r88  
    1 <?php use_helpers('Date', 'Global') ?> 
     1<?php use_helper('Date', 'Global') ?> 
    22 
    33<h2><?php echo $question->getTitle() ?></h2> 
  • trunk/apps/frontend/modules/user/templates/loginSuccess.php

    r76 r88  
    1 <?php use_helpers('Validation', 'Javascript') ?> 
     1<?php use_helper('Validation', 'Javascript') ?> 
    22 
    33<h1><?php echo __('sign in / register') ?></h1> 
  • trunk/apps/frontend/modules/user/templates/showSuccess.php

    r69 r88  
    1 <?php use_helpers('Date', 'Question', 'Text', 'Object') ?> 
     1<?php use_helper('Date', 'Question', 'Text', 'Object', 'Validation') ?> 
    22 
    33<h1><?php echo __('%1%\'s profile', array('%1%' => $subscriber->__toString())) ?> 
  • trunk/apps/frontend/templates/layout.php

    r72 r88  
    88<?php echo include_title() ?> 
    99 
    10 <?php echo include_stylesheets() ?> 
    11 <?php echo include_javascripts() ?> 
     10 
     11 
    1212 
    1313<?php echo auto_discovery_link_tag('rss', 'feed/popular') ?> 
  • trunk/config/config.php

    r2 r88  
    11<?php 
    22 
     3$sf_symfony_lib_dir  = dirname(__FILE__).'/../lib/vendor/symfony/lib'; 
     4$sf_symfony_data_dir = dirname(__FILE__).'/../lib/vendor/symfony/data'; 
     5 
     6 
    37?> 
  • trunk/config/propel.ini

    r71 r88  
    1 propel.targetPackage = model 
     1propel.targetPackage = lib.model 
    22propel.project = askeet 
    33propel.database = mysql 
    44propel.database.createUrl = mysql://localhost/ 
    5 propel.database.url = mysql://localhost/askeet 
     5propel.database.url = mysql://root@localhost/askeet 
    66 
    77propel.mysql.tableType = InnoDB 
    8  
     8propel.schema.validate     = false 
    99propel.addGenericAccessors = true 
    1010propel.addGenericMutators = true 
     
    1919propel.sql.dir = ${propel.output.dir}/data/sql 
    2020propel.runtime.conf.file = runtime-conf.xml 
    21 propel.php.dir = ${propel.output.dir}/lib 
     21propel.php.dir = ${propel.output.dir} 
    2222propel.default.schema.basename = schema 
    2323propel.datadump.mapper.from = *schema.xml 
     
    2525 
    2626; builder settings 
    27 propel.builder.peer.class = symfony.addon.propel.builder.SfPeerBuilder 
    28 propel.builder.object.class = symfony.addon.propel.builder.SfObjectBuilder 
     27propel.builder.peer.class = addon.propel.builder.SfPeerBuilder 
     28propel.builder.object.class = addon.propel.builder.SfObjectBuilder 
    2929 
    30 propel.builder.objectstub.class = propel.engine.builder.om.php5.PHP5ExtensionObjectBuilder 
    31 propel.builder.peerstub.class = propel.engine.builder.om.php5.PHP5ExtensionPeerBuilder 
    32 propel.builder.objectmultiextend.class = propel.engine.builder.om.php5.PHP5MultiExtendObjectBuilder 
    33 propel.builder.mapbuilder.class = propel.engine.builder.om.php5.PHP5MapBuilderBuilder 
     30propel.builder.objectstub.class = addon.propel.builder.SfExtensionObjectBuilder 
     31propel.builder.peerstub.class = addon.propel.builder.SfExtensionPeerBuilder 
     32propel.builder.objectmultiextend.class = addon.propel.builder.SfMultiExtendObjectBuilder 
     33propel.builder.mapbuilder.class = addon.propel.builder.SfMapBuilderBuilder 
    3434propel.builder.interface.class = propel.engine.builder.om.php5.PHP5InterfaceBuilder 
    3535propel.builder.node.class = propel.engine.builder.om.php5.PHP5NodeBuilder 
     
    3737propel.builder.nodestub.class = propel.engine.builder.om.php5.PHP5ExtensionNodeBuilder 
    3838propel.builder.nodepeerstub.class = propel.engine.builder.om.php5.PHP5ExtensionNodePeerBuilder 
     39propel.packageObjectModel = true 
     40 
     41propel.builder.addIncludes = false 
     42propel.builder.addComments = false 
  • trunk/config/schema.xml

    r62 r88  
    11<?xml version="1.0" encoding="UTF-8"?> 
    2  <database name="symfony" defaultIdMethod="native"> 
     2 <database package="lib.model" name="symfony" defaultIdMethod="native"> 
    33   <table name="ask_question" phpName="Question"> 
    44     <column name="id" type="integer" required="true" primaryKey="true" autoincrement="true" /> 
  • trunk/data/sql/sqldb.map

    r4 r88  
    11# Sqlfile -> Database map 
    22schema.sql=symfony 
     3lib.model.schema.sql=symfony 
  • trunk/lib/model/Answer.php

    r85 r88  
    11<?php 
    22 
    3 require_once 'model/om/BaseAnswer.php'; 
     3require_once 'lib/model/om/BaseAnswer.php'; 
    44 
    55 
  • trunk/lib/model/AnswerPeer.php

    r69 r88  
    22 
    33  // include base peer class 
    4   require_once 'model/om/BaseAnswerPeer.php'; 
     4  require_once 'lib/model/om/BaseAnswerPeer.php'; 
    55   
    66  // include object class 
    7   include_once 'model/Answer.php'; 
     7  include_once 'lib/model/Answer.php'; 
    88 
    99 
  • trunk/lib/model/Interest.php

    r12 r88  
    11<?php 
    22 
    3 require_once 'model/om/BaseInterest.php'; 
     3require_once 'lib/model/om/BaseInterest.php'; 
    44 
    55 
  • trunk/lib/model/InterestPeer.php

    r4 r88  
    22 
    33  // include base peer class 
    4   require_once 'model/om/BaseInterestPeer.php'; 
     4  require_once 'lib/model/om/BaseInterestPeer.php'; 
    55   
    66  // include object class 
    7   include_once 'model/Interest.php'; 
     7  include_once 'lib/model/Interest.php'; 
    88 
    99 
  • trunk/lib/model/Question.php

    r85 r88  
    11<?php 
    22 
    3 require_once 'model/om/BaseQuestion.php'; 
     3require_once 'lib/model/om/BaseQuestion.php'; 
    44 
    55 
  • trunk/lib/model/QuestionPeer.php

    r82 r88  
    22 
    33  // include base peer class 
    4   require_once 'model/om/BaseQuestionPeer.php'; 
     4  require_once 'lib/model/om/BaseQuestionPeer.php'; 
    55   
    66  // include object class 
    7   include_once 'model/Question.php'; 
     7  include_once 'lib/model/Question.php'; 
    88 
    99 
     
    6565  } 
    6666 
    67   public function getPopular($max = 10) 
     67  public static function getPopular($max = 10) 
    6868  { 
    6969    $c = new Criteria(); 
  • trunk/lib/model/QuestionTag.php

    r58 r88  
    11<?php 
    22 
    3 require_once 'model/om/BaseQuestionTag.php'; 
     3require_once 'lib/model/om/BaseQuestionTag.php'; 
    44 
    55 
  • trunk/lib/model/QuestionTagPeer.php

    r72 r88  
    22 
    33  // include base peer class 
    4   require_once 'model/om/BaseQuestionTagPeer.php'; 
     4  require_once 'lib/model/om/BaseQuestionTagPeer.php'; 
    55   
    66  // include object class 
    7   include_once 'model/QuestionTag.php'; 
     7  include_once 'lib/model/QuestionTag.php'; 
    88 
    99 
  • trunk/lib/model/Relevancy.php

    r12 r88  
    11<?php 
    22 
    3 require_once 'model/om/BaseRelevancy.php'; 
     3require_once 'lib/model/om/BaseRelevancy.php'; 
    44 
    55 
  • trunk/lib/model/RelevancyPeer.php

    r4 r88  
    22 
    33  // include base peer class 
    4   require_once 'model/om/BaseRelevancyPeer.php'; 
     4  require_once 'lib/model/om/BaseRelevancyPeer.php'; 
    55   
    66  // include object class 
    7   include_once 'model/Relevancy.php'; 
     7  include_once 'lib/model/Relevancy.php'; 
    88 
    99 
  • trunk/lib/model/ReportAnswer.php

    r55 r88  
    11<?php 
    22 
    3 require_once 'model/om/BaseReportAnswer.php'; 
     3require_once 'lib/model/om/BaseReportAnswer.php'; 
    44 
    55 
  • trunk/lib/model/ReportAnswerPeer.php

    r55 r88  
    22 
    33  // include base peer class 
    4   require_once 'model/om/BaseReportAnswerPeer.php'; 
     4  require_once 'lib/model/om/BaseReportAnswerPeer.php'; 
    55   
    66  // include object class 
    7   include_once 'model/ReportAnswer.php'; 
     7  include_once 'lib/model/ReportAnswer.php'; 
    88 
    99 
  • trunk/lib/model/ReportQuestion.php

    r55 r88  
    11<?php 
    22 
    3 require_once 'model/om/BaseReportQuestion.php'; 
     3require_once 'lib/model/om/BaseReportQuestion.php'; 
    44 
    55 
  • trunk/lib/model/ReportQuestionPeer.php

    r55 r88  
    22 
    33  // include base peer class 
    4   require_once 'model/om/BaseReportQuestionPeer.php'; 
     4  require_once 'lib/model/om/BaseReportQuestionPeer.php'; 
    55   
    66  // include object class 
    7   include_once 'model/ReportQuestion.php'; 
     7  include_once 'lib/model/ReportQuestion.php'; 
    88 
    99 
  • trunk/lib/model/SearchIndex.php

    r58 r88  
    11<?php 
    22 
    3 require_once 'model/om/BaseSearchIndex.php'; 
     3require_once 'lib/model/om/BaseSearchIndex.php'; 
    44 
    55 
  • trunk/lib/model/SearchIndexPeer.php

    r58 r88  
    22 
    33  // include base peer class 
    4   require_once 'model/om/BaseSearchIndexPeer.php'; 
     4  require_once 'lib/model/om/BaseSearchIndexPeer.php'; 
    55   
    66  // include object class 
    7   include_once 'model/SearchIndex.php'; 
     7  include_once 'lib/model/SearchIndex.php'; 
    88 
    99 
  • trunk/lib/model/User.php

    r69 r88  
    11<?php 
    22 
    3 require_once 'model/om/BaseUser.php'; 
     3require_once 'lib/model/om/BaseUser.php'; 
    44 
    55 
  • trunk/lib/model/UserPeer.php

    r55 r88  
    22 
    33  // include base peer class 
    4   require_once 'model/om/BaseUserPeer.php'; 
     4  require_once 'lib/model/om/BaseUserPeer.php'; 
    55   
    66  // include object class 
    7   include_once 'model/User.php'; 
     7  include_once 'lib/model/User.php'; 
    88 
    99 
  • trunk/lib/model/map/AnswerMapBuilder.php

    r55 r88  
    11<?php 
    2          
    3 require_once 'propel/map/MapBuilder.php'; 
    4 include_once 'creole/CreoleTypes.php'; 
    52 
    63 
    7 /** 
    8  * This class adds structure of 'ask_answer' table to 'symfony' DatabaseMap object. 
    9  * 
    10  * 
    11  * 
    12  * These statically-built map classes are used by Propel to do runtime db structure discovery. 
    13  * For example, the createSelectSql() method checks the type of a given column used in an  
    14  * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive  
    15  * (i.e. if it's a text column type). 
    16  * 
    17  * @package model.map 
    18  */  
     4     
    195class AnswerMapBuilder { 
    206 
    21     /** 
    22      * The (dot-path) name of this class 
    23      */ 
    24     const CLASS_NAME = 'model.map.AnswerMapBuilder';     
     7     
     8    const CLASS_NAME = 'lib.model.map.AnswerMapBuilder';     
    259 
    26     /** 
    27      * The database map. 
    28      */ 
     10     
    2911    private $dbMap; 
    3012 
    31     /** 
    32      * Tells us if this DatabaseMapBuilder is built so that we 
    33      * don't have to re-build it every time. 
    34      * 
    35      * @return boolean true if this DatabaseMapBuilder is built, false otherwise. 
    36      */ 
     13     
    3714    public function isBuilt() 
    3815    { 
     
    4017    } 
    4118 
    42     /** 
    43      * Gets the databasemap this map builder built. 
    44      * 
    45      * @return the databasemap 
    46      */ 
     19     
    4720    public function getDatabaseMap() 
    4821    { 
     
    5023    } 
    5124 
    52     /** 
    53      * The doBuild() method builds the DatabaseMap 
    54      * 
    55      * @return void 
    56      * @throws PropelException 
    57      */ 
     25     
    5826    public function doBuild() 
    5927    { 
     
    8351        $tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false); 
    8452                 
    85     } // doBuild() 
    86  
    87 } // AnswerMapBuilder 
     53    }  
     54}  
  • trunk/lib/model/map/InterestMapBuilder.php

    r4 r88  
    11<?php 
    2          
    3 require_once 'propel/map/MapBuilder.php'; 
    4 include_once 'creole/CreoleTypes.php'; 
    52 
    63 
    7 /** 
    8  * This class adds structure of 'ask_interest' table to 'symfony' DatabaseMap object. 
    9  * 
    10  * 
    11  * 
    12  * These statically-built map classes are used by Propel to do runtime db structure discovery. 
    13  * For example, the createSelectSql() method checks the type of a given column used in an  
    14  * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive  
    15  * (i.e. if it's a text column type). 
    16  * 
    17  * @package model.map 
    18  */  
     4     
    195class InterestMapBuilder { 
    206 
    21     /** 
    22      * The (dot-path) name of this class 
    23      */ 
    24     const CLASS_NAME = 'model.map.InterestMapBuilder';   
     7     
     8    const CLASS_NAME = 'lib.model.map.InterestMapBuilder';   
    259 
    26     /** 
    27      * The database map. 
    28      */ 
     10     
    2911    private $dbMap; 
    3012 
    31     /** 
    32      * Tells us if this DatabaseMapBuilder is built so that we 
    33      * don't have to re-build it every time. 
    34      * 
    35      * @return boolean true if this DatabaseMapBuilder is built, false otherwise. 
    36      */ 
     13     
    3714    public function isBuilt() 
    3815    { 
     
    4017    } 
    4118 
    42     /** 
    43      * Gets the databasemap this map builder built. 
    44      * 
    45      * @return the databasemap 
    46      */ 
     19     
    4720    public function getDatabaseMap() 
    4821    { 
     
    5023    } 
    5124 
    52     /** 
    53      * The doBuild() method builds the DatabaseMap 
    54      * 
    55      * @return void 
    56      * @throws PropelException 
    57      */ 
     25     
    5826    public function doBuild() 
    5927    { 
     
    7139        $tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false); 
    7240                 
    73     } // doBuild() 
    74  
    75 } // InterestMapBuilder 
     41    }  
     42}  
  • trunk/lib/model/map/QuestionMapBuilder.php

    r55 r88  
    11<?php 
    2          
    3 require_once 'propel/map/MapBuilder.php'; 
    4 include_once 'creole/CreoleTypes.php'; 
    52 
    63 
    7 /** 
    8  * This class adds structure of 'ask_question' table to 'symfony' DatabaseMap object. 
    9  * 
    10  * 
    11  * 
    12  * These statically-built map classes are used by Propel to do runtime db structure discovery. 
    13  * For example, the createSelectSql() method checks the type of a given column used in an  
    14  * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive  
    15  * (i.e. if it's a text column type). 
    16  * 
    17  * @package model.map 
    18  */  
     4     
    195class QuestionMapBuilder { 
    206 
    21     /** 
    22      * The (dot-path) name of this class 
    23      */ 
    24     const CLASS_NAME = 'model.map.QuestionMapBuilder';   
     7     
     8    const CLASS_NAME = 'lib.model.map.QuestionMapBuilder';   
    259 
    26     /** 
    27      * The database map. 
    28      */ 
     10     
    2911    private $dbMap; 
    3012 
    31     /** 
    32      * Tells us if this DatabaseMapBuilder is built so that we 
    33      * don't have to re-build it every time. 
    34      * 
    35      * @return boolean true if this DatabaseMapBuilder is built, false otherwise. 
    36      */ 
     13     
    3714    public function isBuilt() 
    3815    { 
     
    4017    } 
    4118 
    42     /** 
    43      * Gets the databasemap this map builder built. 
    44      * 
    45      * @return the databasemap 
    46      */ 
     19     
    4720    public function getDatabaseMap() 
    4821    { 
     
    5023    } 
    5124 
    52     /** 
    53      * The doBuild() method builds the DatabaseMap 
    54      * 
    55      * @return void 
    56      * @throws PropelException 
    57      */ 
     25     
    5826    public function doBuild() 
    5927    { 
     
    8553        $tMap->addColumn('UPDATED_AT', 'UpdatedAt', 'int', CreoleTypes::TIMESTAMP, false); 
    8654                 
    87     } // doBuild() 
    88  
    89 } // QuestionMapBuilder 
     55    }  
     56}  
  • trunk/lib/model/map/QuestionTagMapBuilder.php

    r55 r88  
    11<?php 
    2          
    3 require_once 'propel/map/MapBuilder.php'; 
    4 include_once 'creole/CreoleTypes.php'; 
    52 
    63 
    7 /** 
    8  * This class adds structure of 'ask_question_tag' table to 'symfony' DatabaseMap object. 
    9  * 
    10  * 
    11  * 
    12  * These statically-built map classes are used by Propel to do runtime db structure discovery. 
    13  * For example, the createSelectSql() method checks the type of a given column used in an  
    14  * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive  
    15  * (i.e. if it's a text column type). 
    16  * 
    17  * @package model.map 
    18  */  
     4     
    195class QuestionTagMapBuilder { 
    206 
    21     /** 
    22      * The (dot-path) name of this class 
    23      */ 
    24     const CLASS_NAME = 'model.map.QuestionTagMapBuilder';    
     7     
     8    const CLASS_NAME = 'lib.model.map.QuestionTagMapBuilder';    
    259 
    26     /** 
    27      * The database map. 
    28      */ 
     10     
    2911    private $dbMap; 
    3012 
    31     /** 
    32      * Tells us if this DatabaseMapBuilder is built so that we 
    33      * don't have to re-build it every time. 
    34      * 
    35      * @return boolean true if this DatabaseMapBuilder is built, false otherwise. 
    36      */ 
     13     
    3714    public function isBuilt() 
    3815    { 
     
    4017    } 
    4118 
    42     /** 
    43      * Gets the databasemap this map builder built. 
    44      * 
    45      * @return the databasemap 
    46      */ 
     19     
    4720    public function getDatabaseMap() 
    4821    { 
     
    5023    } 
    5124 
    52     /** 
    53      * The doBuild() method builds the DatabaseMap 
    54      * 
    55      * @return void 
    56      * @throws PropelException 
    57      */ 
     25     
    5826    public function doBuild() 
    5927    { 
     
    7543        $tMap->addPrimaryKey('NORMALIZED_TAG', 'NormalizedTag', 'string', CreoleTypes::VARCHAR, true, 100); 
    7644                 
    77     } // doBuild() 
    78  
    79 } // QuestionTagMapBuilder 
     45    }  
     46}  
  • trunk/lib/model/map/RelevancyMapBuilder.php

    r20 r88  
    11<?php 
    2          
    3 require_once 'propel/map/MapBuilder.php'; 
    4 include_once 'creole/CreoleTypes.php'; 
    52 
    63 
    7 /** 
    8  * This class adds structure of 'ask_relevancy' table to 'symfony' DatabaseMap object. 
    9  * 
    10  * 
    11  * 
    12  * These statically-built map classes are used by Propel to do runtime db structure discovery. 
    13  * For example, the createSelectSql() method checks the type of a given column used in an  
    14  * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive  
    15  * (i.e. if it's a text column type). 
    16  * 
    17  * @package model.map 
    18  */  
     4     
    195class RelevancyMapBuilder { 
    206 
    21     /** 
    22      * The (dot-path) name of this class 
    23      */ 
    24     const CLASS_NAME = 'model.map.RelevancyMapBuilder';  
     7     
     8    const CLASS_NAME = 'lib.model.map.RelevancyMapBuilder';  
    259 
    26     /** 
    27      * The database map. 
    28      */ 
     10     
    2911    private $dbMap; 
    3012 
    31     /** 
    32      * Tells us if this DatabaseMapBuilder is built so that we 
    33      * don't have to re-build it every time. 
    34      * 
    35      * @return boolean true if this DatabaseMapBuilder is built, false otherwise. 
    36      */ 
     13     
    3714    public function isBuilt() 
    3815    { 
     
    4017    } 
    4118 
    42     /** 
    43      * Gets the databasemap this map builder built. 
    44      * 
    45      * @return the databasemap 
    46      */ 
     19     
    4720    public function getDatabaseMap() 
    4821    { 
     
    5023    } 
    5124 
    52     /** 
    53      * The doBuild() method builds the DatabaseMap 
    54      * 
    55      * @return void 
    56      * @throws PropelException 
    57      */ 
     25     
    5826    public function doBuild() 
    5927    { 
     
    7341        $tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false); 
    7442                 
    75     } // doBuild() 
    76  
    77 } // RelevancyMapBuilder 
     43    }  
     44}  
  • trunk/lib/model/map/ReportAnswerMapBuilder.php

    r55 r88  
    11<?php 
    2          
    3 require_once 'propel/map/MapBuilder.php'; 
    4 include_once 'creole/CreoleTypes.php'; 
    52 
    63 
    7 /** 
    8  * This class adds structure of 'ask_report_answer' table to 'symfony' DatabaseMap object. 
    9  * 
    10  * 
    11  * 
    12  * These statically-built map classes are used by Propel to do runtime db structure discovery. 
    13  * For example, the createSelectSql() method checks the type of a given column used in an  
    14  * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive  
    15  * (i.e. if it's a text column type). 
    16  * 
    17  * @package model.map 
    18  */  
     4     
    195class ReportAnswerMapBuilder { 
    206 
    21     /** 
    22      * The (dot-path) name of this class 
    23      */ 
    24     const CLASS_NAME = 'model.map.ReportAnswerMapBuilder';   
     7     
     8    const CLASS_NAME = 'lib.model.map.ReportAnswerMapBuilder';   
    259 
    26     /** 
    27      * The database map. 
    28      */ 
     10     
    2911    private $dbMap; 
    3012 
    31     /** 
    32      * Tells us if this DatabaseMapBuilder is built so that we 
    33      * don't have to re-build it every time. 
    34      * 
    35      * @return boolean true if this DatabaseMapBuilder is built, false otherwise. 
    36      */ 
     13     
    3714    public function isBuilt() 
    3815    { 
     
    4017    } 
    4118 
    42     /** 
    43      * Gets the databasemap this map builder built. 
    44      * 
    45      * @return the databasemap 
    46      */ 
     19     
    4720    public function getDatabaseMap() 
    4821    { 
     
    5023    } 
    5124 
    52     /** 
    53      * The doBuild() method builds the DatabaseMap 
    54      * 
    55      * @return void 
    56      * @throws PropelException 
    57      */ 
     25     
    5826    public function doBuild() 
    5927    { 
     
    7139        $tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false); 
    7240                 
    73     } // doBuild() 
    74  
    75 } // ReportAnswerMapBuilder 
     41    }  
     42}  
  • trunk/lib/model/map/ReportQuestionMapBuilder.php

    r55 r88  
    11<?php 
    2          
    3 require_once 'propel/map/MapBuilder.php'; 
    4 include_once 'creole/CreoleTypes.php'; 
    52 
    63 
    7 /** 
    8  * This class adds structure of 'ask_report_question' table to 'symfony' DatabaseMap object. 
    9  * 
    10  * 
    11  * 
    12  * These statically-built map classes are used by Propel to do runtime db structure discovery. 
    13  * For example, the createSelectSql() method checks the type of a given column used in an  
    14  * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive  
    15  * (i.e. if it's a text column type). 
    16  * 
    17  * @package model.map 
    18  */  
     4     
    195class ReportQuestionMapBuilder { 
    206 
    21     /** 
    22      * The (dot-path) name of this class 
    23      */ 
    24     const CLASS_NAME = 'model.map.ReportQuestionMapBuilder';     
     7     
     8    const CLASS_NAME = 'lib.model.map.ReportQuestionMapBuilder';     
    259 
    26     /** 
    27      * The database map. 
    28      */ 
     10     
    2911    private $dbMap; 
    3012 
    31     /** 
    32      * Tells us if this DatabaseMapBuilder is built so that we 
    33      * don't have to re-build it every time. 
    34      * 
    35      * @return boolean true if this DatabaseMapBuilder is built, false otherwise. 
    36      */ 
     13     
    3714    public function isBuilt() 
    3815    { 
     
    4017    } 
    4118 
    42     /** 
    43      * Gets the databasemap this map builder built. 
    44      * 
    45      * @return the databasemap 
    46      */ 
     19     
    4720    public function getDatabaseMap() 
    4821    { 
     
    5023    } 
    5124 
    52     /** 
    53      * The doBuild() method builds the DatabaseMap 
    54      * 
    55      * @return void 
    56      * @throws PropelException 
    57      */ 
     25     
    5826    public function doBuild() 
    5927    { 
     
    7139        $tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false); 
    7240                 
    73     } // doBuild() 
    74  
    75 } // ReportQuestionMapBuilder 
     41    }  
     42}  
  • trunk/lib/model/map/SearchIndexMapBuilder.php

    r58 r88  
    11<?php 
    2          
    3 require_once 'propel/map/MapBuilder.php'; 
    4 include_once 'creole/CreoleTypes.php'; 
    52 
    63 
    7 /** 
    8  * This class adds structure of 'ask_search_index' table to 'symfony' DatabaseMap object. 
    9  * 
    10  * 
    11  * 
    12  * These statically-built map classes are used by Propel to do runtime db structure discovery. 
    13  * For example, the createSelectSql() method checks the type of a given column used in an  
    14  * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive  
    15  * (i.e. if it's a text column type). 
    16  * 
    17  * @package model.map 
    18  */  
     4     
    195class SearchIndexMapBuilder { 
    206 
    21     /** 
    22      * The (dot-path) name of this class 
    23      */ 
    24     const CLASS_NAME = 'model.map.SearchIndexMapBuilder';    
     7     
     8    const CLASS_NAME = 'lib.model.map.SearchIndexMapBuilder';    
    259 
    26     /** 
    27      * The database map. 
    28      */ 
     10     
    2911    private $dbMap; 
    3012 
    31     /** 
    32      * Tells us if this DatabaseMapBuilder is built so that we 
    33      * don't have to re-build it every time. 
    34      * 
    35      * @return boolean true if this DatabaseMapBuilder is built, false otherwise. 
    36      */ 
     13     
    3714    public function isBuilt() 
    3815    { 
     
    4017    } 
    4118 
    42     /** 
    43      * Gets the databasemap this map builder built. 
    44      * 
    45      * @return the databasemap 
    46      */ 
     19     
    4720    public function getDatabaseMap() 
    4821    { 
     
    5023    } 
    5124 
    52     /** 
    53      * The doBuild() method builds the DatabaseMap 
    54      * 
    55      * @return void 
    56      * @throws PropelException 
    57      */ 
     25     
    5826    public function doBuild() 
    5927    { 
     
    7139        $tMap->addColumn('WEIGHT', 'Weight', 'int', CreoleTypes::INTEGER, false); 
    7240                 
    73     } // doBuild() 
    74  
    75 } // SearchIndexMapBuilder 
     41    }  
     42}  
  • trunk/lib/model/map/UserMapBuilder.php

    r55 r88  
    11<?php 
    2          
    3 require_once 'propel/map/MapBuilder.php'; 
    4 include_once 'creole/CreoleTypes.php'; 
    52 
    63 
    7 /** 
    8  * This class adds structure of 'ask_user' table to 'symfony' DatabaseMap object. 
    9  * 
    10  * 
    11  * 
    12  * These statically-built map classes are used by Propel to do runtime db structure discovery. 
    13  * For example, the createSelectSql() method checks the type of a given column used in an  
    14  * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive  
    15  * (i.e. if it's a text column type). 
    16  * 
    17  * @package model.map 
    18  */  
     4     
    195class UserMapBuilder { 
    206 
    21     /** 
    22      * The (dot-path) name of this class 
    23      */ 
    24     const CLASS_NAME = 'model.map.UserMapBuilder';   
     7     
     8    const CLASS_NAME = 'lib.model.map.UserMapBuilder';   
    259 
    26     /** 
    27      * The database map. 
    28      */ 
     10     
    2911    private $dbMap; 
    3012 
    31     /** 
    32      * Tells us if this DatabaseMapBuilder is built so that we 
    33      * don't have to re-build it every time. 
    34      * 
    35      * @return boolean true if this DatabaseMapBuilder is built, false otherwise. 
    36      */ 
     13     
    3714    public function isBuilt() 
    3815    { 
     
    4017    } 
    4118 
    42     /** 
    43      * Gets the databasemap this map builder built. 
    44      * 
    45      * @return the databasemap 
    46      */ 
     19     
    4720    public function getDatabaseMap() 
    4821    { 
     
    5023    } 
    5124 
    52     /** 
    53      * The doBuild() method builds the DatabaseMap 
    54      * 
    55      * @return void 
    56      * @throws PropelException 
    57      */ 
     25     
    5826    public function doBuild() 
    5927    { 
     
    9159        $tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false); 
    9260                 
    93     } // doBuild() 
    94  
    95 } // UserMapBuilder 
     61    }  
     62}  
  • trunk/lib/model/om/BaseAnswer.php

    r74 r88  
    11<?php 
    22 
    3 require_once 'propel/om/BaseObject.php'; 
    4  
    5 require_once 'propel/om/Persistent.php'; 
    6  
    7  
    8 include_once 'propel/util/Criteria.php'; 
    9  
    10 include_once 'model/AnswerPeer.php'; 
    11  
    12 /** 
    13  * Base class that represents a row from the 'ask_answer' table. 
    14  * 
    15  *  
    16  * 
    17  * @package model.om 
    18  */ 
     3 
    194abstract class BaseAnswer extends BaseObject  implements Persistent { 
    205 
    216 
    22     /** 
    23      * The Peer class. 
    24      * Instance provides a convenient way of calling static methods on a class 
    25      * that calling code may not be able to identify. 
    26      * @var AnswerPeer 
    27      */ 
     7     
     8    const DATABASE_NAME = 'symfony'; 
     9 
     10     
    2811    protected static $peer; 
    2912 
    3013 
    31     /** 
    32      * The value for the id field. 
    33      * @var int 
    34      */ 
     14     
    3515    protected $id; 
    3616 
    3717 
    38     /** 
    39      * The value for the question_id field. 
    40      * @var int 
    41      */ 
     18     
    4219    protected $question_id; 
    4320 
    4421 
    45     /** 
    46      * The value for the user_id field. 
    47      * @var int 
    48      */ 
     22     
    4923    protected $user_id; 
    5024 
    5125 
    52     /** 
    53      * The value for the body field. 
    54      * @var string 
    55      */ 
     26     
    5627    protected $body; 
    5728 
    5829 
    59     /** 
    60      * The value for the html_body field. 
    61      * @var string 
    62      */ 
     30     
    6331    protected $html_body; 
    6432 
    6533 
    66     /** 
    67      * The value for the relevancy_up field. 
    68      * @var int 
    69      */ 
     34     
    7035    protected $relevancy_up = 0; 
    7136 
    7237 
    73     /** 
    74      * The value for the relevancy_down field. 
    75      * @var int 
    76      */ 
     38     
    7739    protected $relevancy_down = 0; 
    7840 
    7941 
    80     /** 
    81      * The value for the reports field. 
    82      * @var int 
    83      */ 
     42     
    8443    protected $reports = 0; 
    8544 
    8645 
    87     /** 
    88      * The value for the created_at field. 
    89      * @var int 
    90      */ 
     46     
    9147    protected $created_at; 
    9248 
    93     /** 
    94      * @var Question 
    95      */ 
     49     
    9650    protected $aQuestion; 
    9751 
    98     /** 
    99      * @var User 
    100      */ 
     52     
    10153    protected $aUser; 
    10254 
    103     /** 
    104      * Collection to store aggregation of collRelevancys. 
    105      * @var array 
    106      */ 
     55     
    10756    protected $collRelevancys; 
    108      
    109     /** 
    110      * The criteria used to select the current contents of collRelevancys. 
    111      * @var Criteria 
    112      */ 
    113     private $lastRelevancyCriteria = null; 
    114  
    115     /** 
    116      * Collection to store aggregation of collReportAnswers. 
    117      * @var array 
    118      */ 
     57 
     58     
     59    protected $lastRelevancyCriteria = null; 
     60 
     61     
    11962    protected $collReportAnswers; 
    120      
    121     /** 
    122      * The criteria used to select the current contents of collReportAnswers. 
    123      * @var Criteria 
    124      */ 
    125     private $lastReportAnswerCriteria = null; 
    126  
    127     /** 
    128      * Flag to prevent endless save loop, if this object is referenced 
    129      * by another object which falls in this transaction. 
    130      * @var boolean 
    131      */ 
     63 
     64     
     65    protected $lastReportAnswerCriteria = null; 
     66 
     67     
    13268    protected $alreadyInSave = false; 
    13369 
    134     /** 
    135      * Flag to prevent endless validation loop, if this object is referenced 
    136      * by another object which falls in this transaction. 
    137      * @var boolean 
    138      */ 
     70     
    13971    protected $alreadyInValidation = false; 
    14072 
    141     /** 
    142      * Get the [id] column value. 
    143      *  
    144      * @return int 
    145      */ 
     73     
    14674    public function getId() 
    14775    { 
     
    15078    } 
    15179 
    152     /** 
    153      * Get the [question_id] column value. 
    154      *  
    155      * @return int 
    156      */ 
     80     
    15781    public function getQuestionId() 
    15882    { 
     
    16185    } 
    16286 
    163     /** 
    164      * Get the [user_id] column value. 
    165      *  
    166      * @return int 
    167      */ 
     87     
    16888    public function getUserId() 
    16989    { 
     
    17292    } 
    17393 
    174     /** 
    175      * Get the [body] column value. 
    176      *  
    177      * @return string 
    178      */ 
     94     
    17995    public function getBody() 
    18096    { 
     
    18399    } 
    184100 
    185     /** 
    186      * Get the [html_body] column value. 
    187      *  
    188      * @return string 
    189      */ 
     101     
    190102    public function getHtmlBody() 
    191103    { 
     
    194106    } 
    195107 
    196     /** 
    197      * Get the [relevancy_up] column value. 
    198      *  
    199      * @return int 
    200      */ 
     108     
    201109    public function getRelevancyUp() 
    202110    { 
     
    205113    } 
    206114 
    207     /** 
    208      * Get the [relevancy_down] column value. 
    209      *  
    210      * @return int 
    211      */ 
     115     
    212116    public function getRelevancyDown() 
    213117    { 
     
    216120    } 
    217121 
    218     /** 
    219      * Get the [reports] column value. 
    220      *  
    221      * @return int 
    222      */ 
     122     
    223123    public function getReports() 
    224124    { 
     
    227127    } 
    228128 
    229     /** 
    230      * Get the [optionally formatted] [created_at] column value. 
    231      *  
    232      * @param string $format The date/time format string (either date()-style or strftime()-style). 
    233      *                          If format is NULL, then the integer unix timestamp will be returned. 
    234      * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). 
    235      * @throws PropelException - if unable to convert the date/time to timestamp. 
    236      */ 
     129     
    237130    public function getCreatedAt($format = 'Y-m-d H:i:s') 
    238131    { 
     
    241134            return null; 
    242135        } elseif (!is_int($this->created_at)) { 
    243             // a non-timestamp value was set externally, so we convert it 
    244             $ts = strtotime($this->created_at); 
    245             if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE 
    246                 throw new PropelException("Unable to parse value of [created_at] as date/time value: " . var_export($this->created_at, true)); 
     136                        $ts = strtotime($this->created_at); 
     137            if ($ts === -1 || $ts === false) {              throw new PropelException("Unable to parse value of [created_at] as date/time value: " . var_export($this->created_at, true)); 
    247138            } 
    248139        } else { 
     
    258149    } 
    259150 
    260     /** 
    261      * Set the value of [id] column. 
    262      *  
    263      * @param int $v new value 
    264      * @return void 
    265      */ 
     151     
    266152    public function setId($v) 
    267153    { 
     
    272158        } 
    273159 
    274     } // setId() 
    275  
    276     /** 
    277      * Set the value of [question_id] column. 
    278      *  
    279      * @param int $v new value 
    280      * @return void 
    281      */ 
     160    }  
     161     
    282162    public function setQuestionId($v) 
    283163    { 
     
    290170        if ($this->aQuestion !== null && $this->aQuestion->getId() !== $v) { 
    291171            $this->aQuestion = null; 
    292         }        
    293  
    294     } // setQuestionId() 
    295  
    296     /** 
    297      * Set the value of [user_id] column. 
    298      *  
    299      * @param int $v new value 
    300      * @return void 
    301      */ 
     172        } 
     173 
     174    }  
     175     
    302176    public function setUserId($v) 
    303177    { 
     
    310184        if ($this->aUser !== null && $this->aUser->getId() !== $v) { 
    311185            $this->aUser = null; 
    312         }        
    313  
    314     } // setUserId() 
    315  
    316     /** 
    317      * Set the value of [body] column. 
    318      *  
    319      * @param string $v new value 
    320      * @return void 
    321      */ 
     186        } 
     187 
     188    }  
     189     
    322190    public function setBody($v) 
    323191    { 
     
    328196        } 
    329197 
    330     } // setBody() 
    331  
    332     /** 
    333      * Set the value of [html_body] column. 
    334      *  
    335      * @param string $v new value 
    336      * @return void 
    337      */ 
     198    }  
     199     
    338200    public function setHtmlBody($v) 
    339201    { 
     
    344206        } 
    345207 
    346     } // setHtmlBody() 
    347  
    348     /** 
    349      * Set the value of [relevancy_up] column. 
    350      *  
    351      * @param int $v new value 
    352      * @return void 
    353      */ 
     208    }  
     209     
    354210    public function setRelevancyUp($v) 
    355211    { 
     
    360216        } 
    361217 
    362     } // setRelevancyUp() 
    363  
    364     /** 
    365      * Set the value of [relevancy_down] column. 
    366      *  
    367      * @param int $v new value 
    368      * @return void 
    369      */ 
     218    }  
     219     
    370220    public function setRelevancyDown($v) 
    371221    { 
     
    376226        } 
    377227 
    378     } // setRelevancyDown() 
    379  
    380     /** 
    381      * Set the value of [reports] column. 
    382      *  
    383      * @param int $v new value 
    384      * @return void 
    385      */ 
     228    }  
     229     
    386230    public function setReports($v) 
    387231    { 
     
    392236        } 
    393237 
    394     } // setReports() 
    395  
    396     /** 
    397      * Set the value of [created_at] column. 
    398      *  
    399      * @param int $v new value 
    400      * @return void 
    401      */ 
     238    }  
     239     
    402240    public function setCreatedAt($v) 
    403241    { 
     
    405243        if ($v !== null && !is_int($v)) { 
    406244            $ts = strtotime($v); 
    407             if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE 
    408                 throw new PropelException("Unable to parse date/time value for [created_at] from input: " . var_export($v, true)); 
     245            if ($ts === -1 || $ts === false) {              throw new PropelException("Unable to parse date/time value for [created_at] from input: " . var_export($v, true)); 
    409246            } 
    410247        } else { 
     
    416253        } 
    417254 
    418     } // setCreatedAt() 
    419  
    420     /** 
    421      * Hydrates (populates) the object variables with values from the database resultset. 
    422      * 
    423      * An offset (1-based "start column") is specified so that objects can be hydrated 
    424      * with a subset of the columns in the resultset rows.  This is needed, for example, 
    425      * for results of JOIN queries where the resultset row includes columns from two or 
    426      * more tables. 
    427      * 
    428      * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. 
    429      * @param int $startcol 1-based offset column which indicates which restultset column to start with. 
    430      * @return int next starting column 
    431      * @throws PropelException  - Any caught Exception will be rewrapped as a PropelException. 
    432      */ 
     255    }  
     256     
    433257    public function hydrate(ResultSet $rs, $startcol = 1) 
    434258    { 
     
    457281            $this->setNew(false); 
    458282 
    459             // FIXME - using NUM_COLUMNS may be clearer. 
    460             return $startcol + 9; // 9 = AnswerPeer::NUM_COLUMNS - AnswerPeer::NUM_LAZY_LOAD_COLUMNS). 
    461  
     283                        return $startcol + 9;  
    462284        } catch (Exception $e) { 
    463285            throw new PropelException("Error populating Answer object", $e); 
     
    465287    } 
    466288 
    467     /** 
    468      * Removes this object from datastore and sets delete attribute. 
    469      * 
    470      * @param Connection $con 
    471      * @return void 
    472      * @throws PropelException 
    473      * @see BaseObject::setDeleted() 
    474      * @see BaseObject::isDeleted() 
    475      */ 
     289     
    476290    public function delete($con = null) 
    477291    { 
     
    495309    } 
    496310 
    497     /** 
    498      * Stores the object in the database.  If the object is new, 
    499      * it inserts it; otherwise an update is performed.  This method 
    500      * wraps the doSave() worker method in a transaction. 
    501      * 
    502      * @param Connection $con 
    503      * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. 
    504      * @throws PropelException 
    505      * @see doSave() 
    506      */ 
     311     
    507312    public function save($con = null) 
    508313    { 
    509     if ($this->isNew()
     314    if ($this->isNew() && !$this->isColumnModified(AnswerPeer::CREATED_AT)
    510315    { 
    511316      $this->setCreatedAt(time()); 
     
    519324            $con = Propel::getConnection(AnswerPeer::DATABASE_NAME); 
    520325        } 
    521          
     326 
    522327        try { 
    523328            $con->begin(); 
     
    531336    } 
    532337 
    533     /** 
    534      * Stores the object in the database. 
    535      *  
    536      * If the object is new, it inserts it; otherwise an update is performed. 
    537      * All related objects are also updated in this method. 
    538      * 
    539      * @param Connection $con 
    540      * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. 
    541      * @throws PropelException 
    542      * @see save() 
    543      */ 
     338     
    544339    protected function doSave($con) 
    545340    { 
    546         $affectedRows = 0; // initialize var to track total num of affected rows     
    547         if (!$this->alreadyInSave) { 
     341        $affectedRows = 0;      if (!$this->alreadyInSave) { 
    548342            $this->alreadyInSave = true; 
    549343 
    550344 
    551             // We call the save method on the following object(s) if they 
    552             // were passed to this object by their coresponding set 
    553             // method.  This object relates to these object(s) by a 
    554             // foreign key reference. 
    555  
     345                                                 
    556346            if ($this->aQuestion !== null) { 
    557347                if ($this->aQuestion->isModified()) { 
     
    567357                $this->setUser($this->aUser); 
    568358            } 
    569      
    570  
    571             // If this object has been modified, then save it to the database. 
    572             if ($this->isModified()) { 
     359 
     360 
     361                        if ($this->isModified()) { 
    573362                if ($this->isNew()) { 
    574363                    $pk = AnswerPeer::doInsert($this, $con); 
    575                     $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which  
    576                                          // should always be true here (even though technically  
    577                                          // BasePeer::doInsert() can insert multiple rows). 
    578  
    579                     $this->setId($pk);  //[IMV] update autoincrement primary key 
    580  
     364                    $affectedRows += 1;                                                                                   
     365                    $this->setId($pk);   
    581366                    $this->setNew(false); 
    582367                } else { 
    583368                    $affectedRows += AnswerPeer::doUpdate($this, $con); 
    584369                } 
    585                 $this->resetModified(); // [HL] After being saved an object is no longer 'modified' 
    586             } 
     370                $this->resetModified();             } 
    587371 
    588372            if ($this->collRelevancys !== null) { 
     
    605389        } 
    606390        return $affectedRows; 
    607     } // doSave() 
    608  
    609     /** 
    610      * Array of ValidationFailed objects. 
    611      * @var array ValidationFailed[] 
    612      */ 
     391    }  
     392     
    613393    protected $validationFailures = array(); 
    614394 
    615     /** 
    616      * Gets any ValidationFailed objects that resulted from last call to validate(). 
    617      * 
    618      * 
    619      * @return array ValidationFailed[] 
    620      * @see validate() 
    621      */ 
     395     
    622396    public function getValidationFailures() 
    623397    { 
     
    625399    } 
    626400 
    627     /** 
    628      * Validates the objects modified field values and all objects related to this table. 
    629      * 
    630      * If $columns is either a column name or an array of column names 
    631      * only those columns are validated. 
    632      * 
    633      * @param mixed $columns Column name or an array of column names. 
    634      * @return boolean Whether all columns pass validation. 
    635      * @see doValidate() 
    636      * @see getValidationFailures() 
    637      */ 
     401     
    638402    public function validate($columns = null) 
    639403    { 
     
    648412    } 
    649413 
    650     /** 
    651      * This function performs the validation work for complex object models. 
    652      * 
    653      * In addition to checking the current object, all related objects will 
    654      * also be validated.  If all pass then <code>true</code> is returned; otherwise 
    655      * an aggreagated array of ValidationFailed objects will be returned. 
    656      * 
    657      * @param array $columns Array of column names to validate. 
    658      * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. 
    659      */ 
     414     
    660415    protected function doValidate($columns = null) 
    661416    { 
     
    667422 
    668423 
    669             // We call the validate method on the following object(s) if they 
    670             // were passed to this object by their coresponding set 
    671             // method.  This object relates to these object(s) by a 
    672             // foreign key reference. 
    673  
     424                                                 
    674425            if ($this->aQuestion !== null) { 
    675426                if (!$this->aQuestion->validate($columns)) { 
     
    713464    } 
    714465 
    715     /** 
    716      * Retrieves a field from the object by name passed in as a string. 
    717      * 
    718      * @param string $name name 
    719      * @param string $type The type of fieldname the $name is of: 
    720      *                     one of the class type constants TYPE_PHPNAME, 
    721      *                     TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM 
    722      * @return mixed Value of field. 
    723      */ 
     466     
    724467    public function getByName($name, $type = BasePeer::TYPE_PHPNAME) 
    725468    { 
     
    728471    } 
    729472 
    730     /** 
    731      * Retrieves a field from the object by Position as specified in the xml schema. 
    732      * Zero-based. 
    733      * 
    734      * @param int $pos position in xml schema 
    735      * @return mixed Value of field at $pos 
    736      */ 
     473     
    737474    public function getByPosition($pos) 
    738475    { 
     
    768505                return null; 
    769506                break; 
    770         } // switch() 
    771     } 
    772  
    773     /** 
    774      * Exports the object as an array. 
    775      * 
    776      * You can specify the key type of the array by passing one of the class 
    777      * type constants. 
    778      * 
    779      * @param string $keyType One of the class type constants TYPE_PHPNAME, 
    780      *                        TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM 
    781      * @return an associative array containing the field names (as keys) and field values 
    782      */ 
     507        }   } 
     508 
     509     
    783510    public function toArray($keyType = BasePeer::TYPE_PHPNAME) 
    784511    { 
     
    798525    } 
    799526 
    800     /** 
    801      * Sets a field from the object by name passed in as a string. 
    802      * 
    803      * @param string $name peer name 
    804      * @param mixed $value field value 
    805      * @param string $type The type of fieldname the $name is of: 
    806      *                     one of the class type constants TYPE_PHPNAME, 
    807      *                     TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM 
    808      * @return void 
    809      */ 
     527     
    810528    public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) 
    811529    { 
     
    814532    } 
    815533 
    816     /** 
    817      * Sets a field from the object by Position as specified in the xml schema. 
    818      * Zero-based. 
    819      * 
    820      * @param int $pos position in xml schema 
    821      * @param mixed $value field value 
    822      * @return void 
    823      */ 
     534     
    824535    public function setByPosition($pos, $value) 
    825536    { 
     
    852563                $this->setCreatedAt($value); 
    853564                break; 
    854         } // switch() 
    855     } 
    856  
    857     /** 
    858      * Populates the object using an array. 
    859      * 
    860      * This is particularly useful when populating an object from one of the 
    861      * request arrays (e.g. $_POST).  This method goes through the column 
    862      * names, checking to see whether a matching key exists in populated 
    863      * array. If so the setByName() method is called for that column. 
    864      * 
    865      * You can specify the key type of the array by additionally passing one 
    866      * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, 
    867      * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') 
    868      * 
    869      * @param array  $arr     An array to populate the object from. 
    870      * @param string $keyType The type of keys the array uses. 
    871      * @return void 
    872      */ 
     565        }   } 
     566 
     567     
    873568    public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) 
    874569    { 
     
    886581    } 
    887582 
    888     /** 
    889      * Build a Criteria object containing the values of all modified columns in this object. 
    890      * 
    891      * @return Criteria The Criteria object containing all modified values. 
    892      */ 
     583     
    893584    public function buildCriteria() 
    894585    { 
     
    908599    } 
    909600 
    910     /** 
    911      * Builds a Criteria object containing the primary key for this object. 
    912      * 
    913      * Unlike buildCriteria() this method includes the primary key values regardless 
    914      * of whether or not they have been modified. 
    915      * 
    916      * @return Criteria The Criteria object containing value(s) for primary key(s). 
    917      */ 
     601     
    918602    public function buildPkeyCriteria() 
    919603    { 
     
    925609    } 
    926610 
    927     /** 
    928      * Returns the primary key for this object (row). 
    929      * @return int 
    930      */ 
     611     
    931612    public function getPrimaryKey() 
    932613    { 
     
    934615    } 
    935616 
    936     /** 
    937      * Generic method to set the primary key (id column). 
    938      * 
    939      * @param int $key Primary key. 
    940      * @return void 
    941      */ 
     617     
    942618    public function setPrimaryKey($key) 
    943619    { 
     
    945621    } 
    946622 
    947     /** 
    948      * Sets contents of passed object to values from current object. 
    949      *  
    950      * If desired, this method can also make copies of all associated (fkey referrers) 
    951      * objects. 
    952      * 
    953      * @param object $copyObj An object of Answer (or compatible) type. 
    954      * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. 
    955      * @throws PropelException 
    956      */ 
     623     
    957624    public function copyInto($copyObj, $deepCopy = false) 
    958625    { 
     
    976643 
    977644        if ($deepCopy) { 
    978             // important: temporarily setNew(false) because this affects the behavior of 
    979             // the getter/setter methods for fkey referrer objects. 
    980             $copyObj->setNew(false); 
     645                                    $copyObj->setNew(false); 
    981646 
    982647            foreach($this->getRelevancys() as $relObj) { 
    983                 if($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves 
    984                     $copyObj->addRelevancy($relObj->copy($deepCopy)); 
    985                 } 
     648                $copyObj->addRelevancy($relObj->copy($deepCopy)); 
    986649            } 
    987650 
    988651            foreach($this->getReportAnswers() as $relObj) { 
    989                 if($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves 
    990                     $copyObj->addReportAnswer($relObj->copy($deepCopy)); 
    991                 } 
    992             } 
    993  
    994         } // if ($deepCopy) 
    995  
     652                $copyObj->addReportAnswer($relObj->copy($deepCopy)); 
     653            } 
     654 
     655        }  
    996656 
    997657        $copyObj->setNew(true); 
    998658 
    999         $copyObj->setId(NULL); // this is a pkey column, so set to default value 
    1000  
    1001     } 
    1002  
    1003     /** 
    1004      * Makes a copy of this object that will be inserted as a new row in table when saved. 
    1005      * It creates a new object filling in the simple attributes, but skipping any primary 
    1006      * keys that are defined for the table. 
    1007      *  
    1008      * If desired, this method can also make copies of all associated (fkey referrers) 
    1009      * objects. 
    1010      * 
    1011      * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. 
    1012      * @return Answer Clone of current object. 
    1013      * @throws PropelException 
    1014      */ 
     659        $copyObj->setId(NULL);  
     660    } 
     661 
     662     
    1015663    public function copy($deepCopy = false) 
    1016664    { 
    1017         // we use get_class(), because this might be a subclass 
    1018         $clazz = get_class($this); 
     665                $clazz = get_class($this); 
    1019666        $copyObj = new $clazz(); 
    1020667        $this->copyInto($copyObj, $deepCopy); 
     
    1022669    } 
    1023670 
    1024     /** 
    1025      * Returns a peer instance associated with this om. 
    1026      * 
    1027      * Since Peer classes are not to have any instance attributes, this method returns the 
    1028      * same instance for all member of this class. The method could therefore 
    1029      * be static, but this would prevent one from overriding the behavior. 
    1030      * 
    1031      * @return AnswerPeer 
    1032      */ 
     671     
    1033672    public function getPeer() 
    1034673    { 
     
    1039678    } 
    1040679 
    1041     /** 
    1042      * Declares an association between this object and a Question object. 
    1043      * 
    1044      * @param Question $v 
    1045      * @return void 
    1046      * @throws PropelException 
    1047      */ 
     680     
    1048681    public function setQuestion($v) 
    1049682    { 
     
    1061694 
    1062695 
    1063     /** 
    1064      * Get the associated Question object 
    1065      * 
    1066      * @param Connection Optional Connection object. 
    1067      * @return Question The associated Question object. 
    1068      * @throws PropelException 
    1069      */ 
     696     
    1070697    public function getQuestion($con = null) 
    1071698    { 
    1072         // include the related Peer class 
    1073         include_once 'model/om/BaseQuestionPeer.php'; 
     699                include_once 'lib/model/om/BaseQuestionPeer.php'; 
    1074700 
    1075701        if ($this->aQuestion === null && ($this->question_id !== null)) { 
    1076702 
    1077703            $this->aQuestion = QuestionPeer::retrieveByPK($this->question_id, $con); 
    1078                      
    1079             /* The following can be used instead of the line above to 
    1080                guarantee the related object contains a reference 
    1081                to this object, but this level of coupling 
    1082                may be undesirable in many circumstances. 
    1083                As it can lead to a db query with many results that may 
    1084                never be used. 
    1085                $obj = QuestionPeer::retrieveByPK($this->question_id, $con); 
    1086                $obj->addQuestions($this); 
    1087              */ 
     704 
     705             
    1088706        } 
    1089707        return $this->aQuestion; 
    1090708    } 
    1091709 
    1092     /** 
    1093      * Declares an association between this object and a User object. 
    1094      * 
    1095      * @param User $v 
    1096      * @return void 
    1097      * @throws PropelException 
    1098      */ 
     710     
    1099711    public function setUser($v) 
    1100712    { 
     
    1112724 
    1113725 
    1114     /** 
    1115      * Get the associated User object 
    1116      * 
    1117      * @param Connection Optional Connection object. 
    1118      * @return User The associated User object. 
    1119      * @throws PropelException 
    1120      */ 
     726     
    1121727    public function getUser($con = null) 
    1122728    { 
    1123         // include the related Peer class 
    1124         include_once 'model/om/BaseUserPeer.php'; 
     729                include_once 'lib/model/om/BaseUserPeer.php'; 
    1125730 
    1126731        if ($this->aUser === null && ($this->user_id !== null)) { 
    1127732 
    1128733            $this->aUser = UserPeer::retrieveByPK($this->user_id, $con); 
    1129                      
    1130             /* The following can be used instead of the line above to 
    1131                guarantee the related object contains a reference 
    1132                to this object, but this level of coupling 
    1133                may be undesirable in many circumstances. 
    1134                As it can lead to a db query with many results that may 
    1135                never be used. 
    1136                $obj = UserPeer::retrieveByPK($this->user_id, $con); 
    1137                $obj->addUsers($this); 
    1138              */ 
     734 
     735             
    1139736        } 
    1140737        return $this->aUser; 
    1141738    } 
    1142739 
    1143     /** 
    1144      * Temporary storage of collRelevancys to save a possible db hit in 
    1145      * the event objects are add to the collection, but the 
    1146      * complete collection is never requested. 
    1147      * @return void 
    1148      */ 
     740     
    1149741    public function initRelevancys() 
    1150742    { 
     
    1154746    } 
    1155747 
    1156     /** 
    1157      * If this collection has already been initialized with 
    1158      * an identical criteria, it returns the collection. 
    1159      * Otherwise if this Answer has previously 
    1160      * been saved, it will retrieve related Relevancys from storage. 
    1161      * If this Answer is new, it will return 
    1162      * an empty collection or the current collection, the criteria 
    1163      * is ignored on a new object. 
    1164      * 
    1165      * @param Connection $con 
    1166      * @param Criteria $criteria 
    1167      * @throws PropelException 
    1168      */ 
     748     
    1169749    public function getRelevancys($criteria = null, $con = null) 
    1170750    { 
    1171         // include the Peer class 
    1172         include_once 'model/om/BaseRelevancyPeer.php'; 
     751                include_once 'lib/model/om/BaseRelevancyPeer.php'; 
    1173752        if ($criteria === null) { 
    1174753            $criteria = new Criteria(); 
     
    1190769            } 
    1191770        } else { 
    1192             // criteria has no effect for a new object 
    1193             if (!$this->isNew()) { 
    1194                 // the following code is to determine if a new query is 
    1195                 // called for.  If the criteria is the same as the last 
    1196                 // one, just return the collection. 
    1197  
     771                        if (!$this->isNew()) { 
     772                                                 
    1198773 
    1199774                $criteria->add(RelevancyPeer::ANSWER_ID, $this->getId()); 
     
    1209784    } 
    1210785 
    1211     /** 
    1212      * Returns the number of related Relevancys. 
    1213      * 
    1214      * @param Criteria $criteria 
    1215      * @param boolean $distinct 
    1216      * @param Connection $con 
    1217      * @throws PropelException 
    1218      */ 
     786     
    1219787    public function countRelevancys($criteria = null, $distinct = false, $con = null) 
    1220788    { 
    1221         // include the Peer class 
    1222         include_once 'model/om/BaseRelevancyPeer.php'; 
     789                include_once 'lib/model/om/BaseRelevancyPeer.php'; 
    1223790        if ($criteria === null) { 
    1224791            $criteria = new Criteria(); 
     
    1234801    } 
    1235802 
    1236     /** 
    1237      * Method called to associate a Relevancy object to this object 
    1238      * through the Relevancy foreign key attribute 
    1239      * 
    1240      * @param Relevancy $l Relevancy 
    1241      * @return void 
    1242      * @throws PropelException 
    1243      */ 
     803     
    1244804    public function addRelevancy(Relevancy $l) 
    1245805    { 
     
    1249809 
    1250810 
    1251     /** 
    1252      * If this collection has already been initialized with 
    1253      * an identical criteria, it returns the collection. 
    1254      * Otherwise if this Answer is new, it will return 
    1255      * an empty collection; or if this Answer has previously 
    1256      * been saved, it will retrieve related Relevancys from storage. 
    1257      * 
    1258      * This method is protected by default in order to keep the public 
    1259      * api reasonable.  You can provide public methods for those you 
    1260      * actually need in Answer. 
    1261      */ 
     811     
    1262812    public function getRelevancysJoinUser($criteria = null, $con = null) 
    1263813    { 
    1264         // include the Peer class 
    1265         include_once 'model/om/BaseRelevancyPeer.php'; 
     814                include_once 'lib/model/om/BaseRelevancyPeer.php'; 
    1266815        if ($criteria === null) { 
    1267816            $criteria = new Criteria(); 
     
    1282831            } 
    1283832        } else { 
    1284             // the following code is to determine if a new query is 
    1285             // called for.  If the criteria is the same as the last 
    1286             // one, just return the collection. 
    1287  
     833                                     
    1288834            $criteria->add(RelevancyPeer::ANSWER_ID, $this->getId()); 
    1289835 
     
    1297843    } 
    1298844 
    1299     /** 
    1300      * Temporary storage of collReportAnswers to save a possible db hit in 
    1301      * the event objects are add to the collection, but the 
    1302      * complete collection is never requested. 
    1303      * @return void 
    1304      */ 
     845     
    1305846    public function initReportAnswers() 
    1306847    { 
     
    1310851    } 
    1311852 
    1312     /** 
    1313      * If this collection has already been initialized with 
    1314      * an identical criteria, it returns the collection. 
    1315      * Otherwise if this Answer has previously 
    1316      * been saved, it will retrieve related ReportAnswers from storage. 
    1317      * If this Answer is new, it will return 
    1318      * an empty collection or the current collection, the criteria 
    1319      * is ignored on a new object. 
    1320      * 
    1321      * @param Connection $con 
    1322      * @param Criteria $criteria 
    1323      * @throws PropelException 
    1324      */ 
     853     
    1325854    public function getReportAnswers($criteria = null, $con = null) 
    1326855    { 
    1327         // include the Peer class 
    1328         include_once 'model/om/BaseReportAnswerPeer.php'; 
     856                include_once 'lib/model/om/BaseReportAnswerPeer.php'; 
    1329857        if ($criteria === null) { 
    1330858            $criteria = new Criteria(); 
     
    1346874            } 
    1347875        } else { 
    1348             // criteria has no effect for a new object 
    1349             if (!$this->isNew()) { 
    1350                 // the following code is to determine if a new query is 
    1351                 // called for.  If the criteria is the same as the last 
    1352                 // one, just return the collection. 
    1353  
     876                        if (!$this->isNew()) { 
     877                                                 
    1354878 
    1355879                $criteria->add(ReportAnswerPeer::ANSWER_ID, $this->getId()); 
     
    1365889    } 
    1366890 
    1367     /** 
    1368      * Returns the number of related ReportAnswers. 
    1369      * 
    1370      * @param Criteria $criteria 
    1371      * @param boolean $distinct 
    1372      * @param Connection $con 
    1373      * @throws PropelException 
    1374      */ 
     891     
    1375892    public function countReportAnswers($criteria = null, $distinct = false, $con = null) 
    1376893    { 
    1377         // include the Peer class 
    1378         include_once 'model/om/BaseReportAnswerPeer.php'; 
     894                include_once 'lib/model/om/BaseReportAnswerPeer.php'; 
    1379895        if ($criteria === null) { 
    1380896            $criteria = new Criteria(); 
     
    1390906    } 
    1391907 
    1392     /** 
    1393      * Method called to associate a ReportAnswer object to this object 
    1394      * through the ReportAnswer foreign key attribute 
    1395      * 
    1396      * @param ReportAnswer $l ReportAnswer 
    1397      * @return void 
    1398      * @throws PropelException 
    1399      */ 
     908     
    1400909    public function addReportAnswer(ReportAnswer $l) 
    1401910    { 
     
    1405914 
    1406915 
    1407     /** 
    1408      * If this collection has already been initialized with 
    1409      * an identical criteria, it returns the collection. 
    1410      * Otherwise if this Answer is new, it will return 
    1411      * an empty collection; or if this Answer has previously 
    1412      * been saved, it will retrieve related ReportAnswers from storage. 
    1413      * 
    1414      * This method is protected by default in order to keep the public 
    1415      * api reasonable.  You can provide public methods for those you 
    1416      * actually need in Answer. 
    1417      */ 
     916     
    1418917    public function getReportAnswersJoinUser($criteria = null, $con = null) 
    1419918    { 
    1420         // include the Peer class 
    1421         include_once 'model/om/BaseReportAnswerPeer.php'; 
     919                include_once 'lib/model/om/BaseReportAnswerPeer.php'; 
    1422920        if ($criteria === null) { 
    1423921            $criteria = new Criteria(); 
     
    1438936            } 
    1439937        } else { 
    1440             // the following code is to determine if a new query is 
    1441             // called for.  If the criteria is the same as the last 
    1442             // one, just return the collection. 
    1443  
     938                                     
    1444939            $criteria->add(ReportAnswerPeer::ANSWER_ID, $this->getId()); 
    1445940 
     
    1453948    } 
    1454949 
    1455 } // BaseAnswer 
     950}  
  • trunk/lib/model/om/BaseAnswerPeer.php

    r74 r88  
    11<?php 
    22 
    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  
    8 /** 
    9  * Base static class for performing query and update operations on the 'ask_answer' table. 
    10  * 
    11  *  
    12  * 
    13  * @package model.om 
    14  */ 
     3 
    154abstract class BaseAnswerPeer { 
    165 
    17     /** the default database name for this class */ 
     6     
    187    const DATABASE_NAME = 'symfony'; 
    198 
    20     /** the table name for this class */ 
     9     
    2110    const TABLE_NAME = 'ask_answer'; 
    2211 
    23     /** A class that can be returned by this peer. */ 
    24     const CLASS_DEFAULT = 'model.Answer'; 
    25  
    26     /** The total number of columns. */ 
     12     
     13    const CLASS_DEFAULT = 'lib.model.Answer'; 
     14 
     15     
    2716    const NUM_COLUMNS = 9; 
    2817 
    29     /** The number of lazy-loaded columns. */ 
     18     
    3019    const NUM_LAZY_LOAD_COLUMNS = 0; 
    3120 
    3221 
    33     /** the column name for the ID field */ 
     22     
    3423    const ID = 'ask_answer.ID'; 
    3524 
    36     /** the column name for the QUESTION_ID field */ 
     25     
    3726    const QUESTION_ID = 'ask_answer.QUESTION_ID'; 
    3827 
    39     /** the column name for the USER_ID field */ 
     28     
    4029    const USER_ID = 'ask_answer.USER_ID'; 
    4130 
    42     /** the column name for the BODY field */ 
     31     
    4332    const BODY = 'ask_answer.BODY'; 
    4433 
    45     /** the column name for the HTML_BODY field */ 
     34     
    4635    const HTML_BODY = 'ask_answer.HTML_BODY'; 
    4736 
    48     /** the column name for the RELEVANCY_UP field */ 
     37     
    4938    const RELEVANCY_UP = 'ask_answer.RELEVANCY_UP'; 
    5039 
    51     /** the column name for the RELEVANCY_DOWN field */ 
     40     
    5241    const RELEVANCY_DOWN = 'ask_answer.RELEVANCY_DOWN'; 
    5342 
    54     /** the column name for the REPORTS field */ 
     43     
    5544    const REPORTS = 'ask_answer.REPORTS'; 
    5645 
    57     /** the column name for the CREATED_AT field */ 
     46     
    5847    const CREATED_AT = 'ask_answer.CREATED_AT'; 
    5948 
    60     /** The PHP to DB Name Mapping */ 
     49     
    6150    private static $phpNameMap = null; 
    6251 
    6352 
    64     /** 
    65      * holds an array of fieldnames 
    66      * 
    67      * first dimension keys are the type constants 
    68      * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' 
    69      */ 
     53     
    7054    private static $fieldNames = array ( 
    7155        BasePeer::TYPE_PHPNAME => array ('Id', 'QuestionId', 'UserId', 'Body', 'HtmlBody', 'RelevancyUp', 'RelevancyDown', 'Reports', 'CreatedAt', ), 
     
    7559    ); 
    7660 
    77     /** 
    78      * holds an array of keys for quick access to the fieldnames array 
    79      * 
    80      * first dimension keys are the type constants 
    81      * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 
    82      */ 
     61     
    8362    private static $fieldKeys = array ( 
    8463        BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'QuestionId' => 1, 'UserId' => 2, 'Body' => 3, 'HtmlBody' => 4, 'RelevancyUp' => 5, 'RelevancyDown' => 6, 'Reports' => 7, 'CreatedAt' => 8, ), 
     
    8867    ); 
    8968 
    90     /** 
    91      * @return MapBuilder the map builder for this peer 
    92      * @throws PropelException Any exceptions caught during processing will be 
    93      *       rethrown wrapped into a PropelException. 
    94      */ 
     69     
    9570    public static function getMapBuilder() 
    9671    { 
    97         include_once 'model/map/AnswerMapBuilder.php'; 
    98         return BasePeer::getMapBuilder('model.map.AnswerMapBuilder'); 
    99     } 
    100     /** 
    101      * Gets a map (hash) of PHP names to DB column names. 
    102      * 
    103      * @return array The PHP to DB name map for this peer 
    104      * @throws PropelException Any exceptions caught during processing will be 
    105      *       rethrown wrapped into a PropelException. 
    106      * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. 
    107      */ 
     72        include_once 'lib/model/map/AnswerMapBuilder.php'; 
     73        return BasePeer::getMapBuilder('lib.model.map.AnswerMapBuilder'); 
     74    } 
     75     
    10876    public static function getPhpNameMap() 
    10977    { 
     
    11987        return self::$phpNameMap; 
    12088    } 
    121     /** 
    122      * Translates a fieldname to another type 
    123      * 
    124      * @param string $name field name 
    125      * @param string $fromType One of the class type constants TYPE_PHPNAME, 
    126      *                         TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM 
    127      * @param string $toType   One of the class type constants 
    128      * @return string translated name of the field. 
    129      */ 
     89     
    13090    static public function translateFieldName($name, $fromType, $toType) 
    13191    { 
     
    13898    } 
    13999 
    140     /** 
    141      * Returns an array of of field names. 
    142      * 
    143      * @param  string $type The type of fieldnames to return: 
    144      *                      One of the class type constants TYPE_PHPNAME, 
    145      *                      TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM 
    146      * @return array A list of field names 
    147      */ 
     100     
    148101 
    149102    static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) 
     
    155108    } 
    156109 
    157     /** 
    158      * Convenience method which changes table.column to alias.column. 
    159      * 
    160      * Using this method you can maintain SQL abstraction while using column aliases. 
    161      * <code> 
    162      *      $c->addAlias("alias1", TablePeer::TABLE_NAME); 
    163      *      $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); 
    164      * </code> 
    165      * @param string $alias The alias for the current table. 
    166      * @param string $column The column name for current table. (i.e. AnswerPeer::COLUMN_NAME). 
    167      * @return string 
    168      */ 
     110     
    169111    public static function alias($alias, $column) 
    170112    { 
     
    172114    } 
    173115 
    174     /** 
    175      * Add all the columns needed to create a new object. 
    176      * 
    177      * Note: any columns that were marked with lazyLoad="true" in the 
    178      * XML schema will not be added to the select list and only loaded 
    179      * on demand. 
    180      * 
    181      * @param criteria object containing the columns to add. 
    182      * @throws PropelException Any exceptions caught during processing will be 
    183      *       rethrown wrapped into a PropelException. 
    184      */ 
     116     
    185117    public static function addSelectColumns(Criteria $criteria) 
    186118    { 
     
    209141    const COUNT_DISTINCT = 'COUNT(DISTINCT ask_answer.ID)'; 
    210142 
    211     /** 
    212      * Returns the number of rows matching criteria. 
    213      * 
    214      * @param Criteria $criteria 
    215      * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). 
    216      * @param Connection $con 
    217      * @return int Number of matching rows. 
    218      */ 
     143     
    219144    public static function doCount(Criteria $criteria, $distinct = false, $con = null) 
    220145    { 
    221         // we're going to modify criteria, so copy it first 
    222         $criteria = clone $criteria; 
    223  
    224         // clear out anything that might confuse the ORDER BY clause 
    225         $criteria->clearSelectColumns()->clearOrderByColumns(); 
     146                $criteria = clone $criteria; 
     147 
     148                $criteria->clearSelectColumns()->clearOrderByColumns(); 
    226149        if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { 
    227150            $criteria->addSelectColumn(AnswerPeer::COUNT_DISTINCT); 
     
    230153        } 
    231154 
    232         // just in case we're grouping: add those columns to the select statement 
    233         foreach($criteria->getGroupByColumns() as $column) 
     155                foreach($criteria->getGroupByColumns() as $column) 
    234156        { 
    235157            $criteria->addSelectColumn($column); 
     
    240162            return $rs->getInt(1); 
    241163        } else { 
    242             // no rows returned; we infer that means 0 matches. 
    243             return 0; 
    244         } 
    245     } 
    246     /** 
    247      * Method to select one object from the DB. 
    248      * 
    249      * @param Criteria $criteria object used to create the SELECT statement. 
    250      * @param Connection $con 
    251      * @return Answer 
    252      * @throws PropelException Any exceptions caught during processing will be 
    253      *       rethrown wrapped into a PropelException. 
    254      */ 
     164                        return 0; 
     165        } 
     166    } 
     167     
    255168    public static function doSelectOne(Criteria $criteria, $con = null) 
    256169    { 
     
    263176        return null; 
    264177    } 
    265     /** 
    266      * Method to do selects. 
    267      * 
    268      * @param Criteria $criteria The Criteria object used to build the SELECT statement. 
    269      * @param Connection $con 
    270      * @return array Array of selected Objects 
    271      * @throws PropelException Any exceptions caught during processing will be 
    272      *       rethrown wrapped into a PropelException. 
    273      */ 
     178     
    274179    public static function doSelect(Criteria $criteria, $con = null) 
    275180    { 
    276181        return AnswerPeer::populateObjects(AnswerPeer::doSelectRS($criteria, $con)); 
    277182    } 
    278     /** 
    279      * Prepares the Criteria object and uses the parent doSelect() 
    280      * method to get a ResultSet. 
    281      * 
    282      * Use this method directly if you want to just get the resultset 
    283      * (instead of an array of objects). 
    284      * 
    285      * @param Criteria $criteria The Criteria object used to build the SELECT statement. 
    286      * @param Connection $con the connection to use 
    287      * @throws PropelException Any exceptions caught during processing will be 
    288      *       rethrown wrapped into a PropelException. 
    289      * @return ResultSet The resultset object with numerically-indexed fields. 
    290      * @see BasePeer::doSelect() 
    291      */ 
     183     
    292184    public static function doSelectRS(Criteria $criteria, $con = null) 
    293185    { 
     
    301193        } 
    302194 
    303         // Set the correct dbName 
    304         $criteria->setDbName(self::DATABASE_NAME); 
    305  
    306         // BasePeer returns a Creole ResultSet, set to return 
    307         // rows indexed numerically. 
    308         return BasePeer::doSelect($criteria, $con); 
    309     } 
    310     /** 
    311      * The returned array will contain objects of the default type or 
    312      * objects that inherit from the default. 
    313      * 
    314      * @throws PropelException Any exceptions caught during processing will be 
    315      *       rethrown wrapped into a PropelException. 
    316      */ 
     195                $criteria->setDbName(self::DATABASE_NAME); 
     196 
     197                        return BasePeer::doSelect($criteria, $con); 
     198    } 
     199     
    317200    public static function populateObjects(ResultSet $rs) 
    318201    { 
    319202        $results = array(); 
    320203     
    321         // set the class once to avoid overhead in the loop 
    322         $cls = AnswerPeer::getOMClass(); 
     204                $cls = AnswerPeer::getOMClass(); 
    323205        $cls = Propel::import($cls); 
    324         // populate the object(s) 
    325         while($rs->next()) { 
     206                while($rs->next()) { 
    326207         
    327208            $obj = new $cls(); 
     
    333214    } 
    334215 
    335     /** 
    336      * Returns the number of rows matching criteria, joining the related Question table 
    337      * 
    338      * @param Criteria $c 
    339      * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). 
    340      * @param Connection $con 
    341      * @return int Number of matching rows. 
    342      */ 
     216     
    343217    public static function doCountJoinQuestion(Criteria $criteria, $distinct = false, $con = null) 
    344218    { 
    345         // we're going to modify criteria, so copy it first 
    346         $criteria = clone $criteria; 
    347          
    348         // clear out anything that might confuse the ORDER BY clause 
    349         $criteria->clearSelectColumns()->clearOrderByColumns(); 
     219                $criteria = clone $criteria; 
     220         
     221                $criteria->clearSelectColumns()->clearOrderByColumns(); 
    350222        if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { 
    351223            $criteria->addSelectColumn(AnswerPeer::COUNT_DISTINCT); 
     
    354226        } 
    355227         
    356         // just in case we're grouping: add those columns to the select statement 
    357         foreach($criteria->getGroupByColumns() as $column) 
     228                foreach($criteria->getGroupByColumns() as $column) 
    358229        { 
    359230            $criteria->addSelectColumn($column); 
     
    366237            return $rs->getInt(1); 
    367238        } else { 
    368             // no rows returned; we infer that means 0 matches. 
    369             return 0; 
    370         } 
    371     } 
    372  
    373  
    374     /** 
    375      * Returns the number of rows matching criteria, joining the related User table 
    376      * 
    377      * @param Criteria $c 
    378      * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). 
    379      * @param Connection $con 
    380      * @return int Number of matching rows. 
    381      */ 
     239                        return 0; 
     240        } 
     241    } 
     242 
     243 
     244     
    382245    public static function doCountJoinUser(Criteria $criteria, $distinct = false, $con = null) 
    383246    { 
    384         // we're going to modify criteria, so copy it first 
    385         $criteria = clone $criteria; 
    386          
    387         // clear out anything that might confuse the ORDER BY clause 
    388         $criteria->clearSelectColumns()->clearOrderByColumns(); 
     247                $criteria = clone $criteria; 
     248         
     249                $criteria->clearSelectColumns()->clearOrderByColumns(); 
    389250        if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { 
    390251            $criteria->addSelectColumn(AnswerPeer::COUNT_DISTINCT); 
     
    393254        } 
    394255         
    395         // just in case we're grouping: add those columns to the select statement 
    396         foreach($criteria->getGroupByColumns() as $column) 
     256                foreach($criteria->getGroupByColumns() as $column) 
    397257        { 
    398258            $criteria->addSelectColumn($column); 
     
    405265            return $rs->getInt(1); 
    406266        } else { 
    407             // no rows returned; we infer that means 0 matches. 
    408             return 0; 
    409         } 
    410     } 
    411  
    412  
    413     /** 
    414      * Selects a collection of Answer objects pre-filled with their Question objects. 
    415      * 
    416      * @return array Array of Answer objects. 
    417      * @throws PropelException Any exceptions caught during processing will be 
    418      *       rethrown wrapped into a PropelException. 
    419      */ 
     267                        return 0; 
     268        } 
     269    } 
     270 
     271 
     272     
    420273    public static function doSelectJoinQuestion(Criteria $c, $con = null) 
    421274    { 
    422275        $c = clone $c; 
    423276 
    424         // Set the correct dbName if it has not been overridden 
    425         if ($c->getDbName() == Propel::getDefaultDB()) { 
     277                if ($c->getDbName() == Propel::getDefaultDB()) { 
    426278            $c->setDbName(self::DATABASE_NAME); 
    427279        } 
     
    451303            $newObject = true; 
    452304            foreach($results as $temp_obj1) { 
    453                 $temp_obj2 = $temp_obj1->getQuestion(); //CHECKME 
    454                 if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { 
     305                $temp_obj2 = $temp_obj1->getQuestion();                 if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { 
    455306                    $newObject = false; 
    456                     // e.g. $author->addBookRelatedByBookId() 
    457                     $temp_obj2->addAnswer($obj1); //CHECKME 
    458                     break; 
     307                                        $temp_obj2->addAnswer($obj1);                   break; 
    459308                } 
    460309            } 
    461310            if ($newObject) { 
    462311                $obj2->initAnswers(); 
    463                 $obj2->addAnswer($obj1); //CHECKME 
    464             } 
     312                $obj2->addAnswer($obj1);            } 
    465313            $results[] = $obj1; 
    466314        } 
     
    469317 
    470318 
    471     /** 
    472      * Selects a collection of Answer objects pre-filled with their User objects. 
    473      * 
    474      * @return array Array of Answer objects. 
    475      * @throws PropelException Any exceptions caught during processing will be 
    476      *       rethrown wrapped into a PropelException. 
    477      */ 
     319     
    478320    public static function doSelectJoinUser(Criteria $c, $con = null) 
    479321    { 
    480322        $c = clone $c; 
    481323 
    482         // Set the correct dbName if it has not been overridden 
    483         if ($c->getDbName() == Propel::getDefaultDB()) { 
     324                if ($c->getDbName() == Propel::getDefaultDB()) { 
    484325            $c->setDbName(self::DATABASE_NAME); 
    485326        } 
     
    509350            $newObject = true; 
    510351            foreach($results as $temp_obj1) { 
    511                 $temp_obj2 = $temp_obj1->getUser(); //CHECKME 
    512                 if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { 
     352                $temp_obj2 = $temp_obj1->getUser();                 if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { 
    513353                    $newObject = false; 
    514                     // e.g. $author->addBookRelatedByBookId() 
    515                     $temp_obj2->addAnswer($obj1); //CHECKME 
    516                     break; 
     354                                        $temp_obj2->addAnswer($obj1);                   break; 
    517355                } 
    518356            } 
    519357            if ($newObject) { 
    520358                $obj2->initAnswers(); 
    521                 $obj2->addAnswer($obj1); //CHECKME 
    522             } 
     359                $obj2->addAnswer($obj1);            } 
    523360            $results[] = $obj1; 
    524361        } 
     
    527364 
    528365 
    529     /** 
    530      * Returns the number of rows matching criteria, joining all related tables 
    531      * 
    532      * @param Criteria $c 
    533      * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). 
    534      * @param Connection $con 
    535      * @return int Number of matching rows. 
    536      */ 
     366     
    537367    public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) 
    538368    { 
    539369        $criteria = clone $criteria; 
    540370 
    541         // clear out anything that might confuse the ORDER BY clause 
    542         $criteria->clearSelectColumns()->clearOrderByColumns(); 
     371                $criteria->clearSelectColumns()->clearOrderByColumns(); 
    543372        if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { 
    544373            $criteria->addSelectColumn(AnswerPeer::COUNT_DISTINCT); 
     
    547376        } 
    548377         
    549         // just in case we're grouping: add those columns to the select statement 
    550         foreach($criteria->getGroupByColumns() as $column) 
     378                foreach($criteria->getGroupByColumns() as $column) 
    551379        { 
    552380            $criteria->addSelectColumn($column); 
     
    561389            return $rs->getInt(1); 
    562390        } else { 
    563             // no rows returned; we infer that means 0 matches. 
    564             return 0; 
    565         } 
    566     } 
    567  
    568  
    569     /** 
    570      * Selects a collection of Answer objects pre-filled with all related objects. 
    571      * 
    572      * @return array Array of Answer objects. 
    573      * @throws PropelException Any exceptions caught during processing will be 
    574      *       rethrown wrapped into a PropelException. 
    575      */ 
     391                        return 0; 
     392        } 
     393    } 
     394 
     395 
     396     
    576397    public static function doSelectJoinAll(Criteria $c, $con = null) 
    577398    { 
    578399        $c = clone $c; 
    579400 
    580         // Set the correct dbName if it has not been overridden 
    581         if ($c->getDbName() == Propel::getDefaultDB()) { 
     401                if ($c->getDbName() == Propel::getDefaultDB()) { 
    582402            $c->setDbName(self::DATABASE_NAME); 
    583403        } 
     
    609429 
    610430                 
    611                 // Add objects for joined Question rows 
    612      
     431                     
    613432            $omClass = QuestionPeer::getOMClass(); 
    614433 
     
    621440            for ($j=0, $resCount=count($results); $j < $resCount; $j++) { 
    622441                $temp_obj1 = $results[$j]; 
    623                 $temp_obj2 = $temp_obj1->getQuestion(); // CHECKME 
    624                 if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { 
     442                $temp_obj2 = $temp_obj1->getQuestion();                 if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { 
    625443                    $newObject = false; 
    626                     $temp_obj2->addAnswer($obj1); // CHECKME 
    627                     break; 
     444                    $temp_obj2->addAnswer($obj1);                   break; 
    628445                } 
    629446            } 
     
    635452 
    636453                 
    637                 // Add objects for joined User rows 
    638      
     454                     
    639455            $omClass = UserPeer::getOMClass(); 
    640456 
     
    647463            for ($j=0, $resCount=count($results); $j < $resCount; $j++) { 
    648464                $temp_obj1 = $results[$j]; 
    649                 $temp_obj3 = $temp_obj1->getUser(); // CHECKME 
    650                 if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { 
     465                $temp_obj3 = $temp_obj1->getUser();                 if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { 
    651466                    $newObject = false; 
    652                     $temp_obj3->addAnswer($obj1); // CHECKME 
    653                     break; 
     467                    $temp_obj3->addAnswer($obj1);                   break; 
    654468                } 
    655469            } 
     
    666480 
    667481 
    668     /** 
    669      * Returns the number of rows matching criteria, joining the related Question table 
    670      * 
    671      * @param Criteria $c 
    672      * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). 
    673      * @param Connection $con 
    674      * @return int Number of matching rows. 
    675      */ 
     482     
    676483    public static function doCountJoinAllExceptQuestion(Criteria $criteria, $distinct = false, $con = null) 
    677484    { 
    678         // we're going to modify criteria, so copy it first 
    679         $criteria = clone $criteria; 
    680          
    681         // clear out anything that might confuse the ORDER BY clause 
    682         $criteria->clearSelectColumns()->clearOrderByColumns(); 
     485                $criteria = clone $criteria; 
     486         
     487                $criteria->clearSelectColumns()->clearOrderByColumns(); 
    683488        if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { 
    684489            $criteria->addSelectColumn(AnswerPeer::COUNT_DISTINCT); 
     
    687492        } 
    688493         
    689         // just in case we're grouping: add those columns to the select statement 
    690         foreach($criteria->getGroupByColumns() as $column) 
     494                foreach($criteria->getGroupByColumns() as $column) 
    691495        { 
    692496            $criteria->addSelectColumn($column); 
     
    699503            return $rs->getInt(1); 
    700504        } else { 
    701             // no rows returned; we infer that means 0 matches. 
    702             return 0; 
    703         } 
    704     } 
    705  
    706  
    707     /** 
    708      * Returns the number of rows matching criteria, joining the related User table 
    709      * 
    710      * @param Criteria $c 
    711      * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). 
    712      * @param Connection $con 
    713      * @return int Number of matching rows. 
    714      */ 
     505                        return 0; 
     506        } 
     507    } 
     508 
     509 
     510     
    715511    public static function doCountJoinAllExceptUser(Criteria $criteria, $distinct = false, $con = null) 
    716512    { 
    717         // we're going to modify criteria, so copy it first 
    718         $criteria = clone $criteria; 
    719          
    720         // clear out anything that might confuse the ORDER BY clause 
    721         $criteria->clearSelectColumns()->clearOrderByColumns(); 
     513                $criteria = clone $criteria; 
     514         
     515                $criteria->clearSelectColumns()->clearOrderByColumns(); 
    722516        if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { 
    723517            $criteria->addSelectColumn(AnswerPeer::COUNT_DISTINCT); 
     
    726520        } 
    727521         
    728         // just in case we're grouping: add those columns to the select statement 
    729         foreach($criteria->getGroupByColumns() as $column) 
     522                foreach($criteria->getGroupByColumns() as $column) 
    730523        { 
    731524            $criteria->addSelectColumn($column); 
     
    738531            return $rs->getInt(1); 
    739532        } else { 
    740             // no rows returned; we infer that means 0 matches. 
    741             return 0; 
    742         } 
    743     } 
    744  
    745  
    746     /** 
    747      * Selects a collection of Answer objects pre-filled with all related objects except Question. 
    748      * 
    749      * @return array Array of Answer objects. 
    750      * @throws PropelException Any exceptions caught during processing will be 
    751      *       rethrown wrapped into a PropelException. 
    752      */ 
     533                        return 0; 
     534        } 
     535    } 
     536 
     537 
     538     
    753539    public static function doSelectJoinAllExceptQuestion(Criteria $c, $con = null) 
    754540    { 
    755541        $c = clone $c; 
    756542 
    757         // Set the correct dbName if it has not been overridden 
    758         // $c->getDbName() will return the same object if not set to another value 
    759         // so == check is okay and faster 
    760         if ($c->getDbName() == Propel::getDefaultDB()) { 
     543                                if ($c->getDbName() == Propel::getDefaultDB()) { 
    761544            $c->setDbName(self::DATABASE_NAME); 
    762545        } 
     
    792575            for ($j=0, $resCount=count($results); $j < $resCount; $j++) { 
    793576                $temp_obj1 = $results[$j]; 
    794                 $temp_obj2 = $temp_obj1->getUser(); //CHECKME 
    795                 if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { 
     577                $temp_obj2 = $temp_obj1->getUser();                 if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { 
    796578                    $newObject = false; 
    797579                    $temp_obj2->addAnswer($obj1); 
     
    811593 
    812594 
    813     /** 
    814      * Selects a collection of Answer objects pre-filled with all related objects except User. 
    815      * 
    816      * @return array Array of Answer objects. 
    817      * @throws PropelException Any exceptions caught during processing will be 
    818      *       rethrown wrapped into a PropelException. 
    819      */ 
     595     
    820596    public static function doSelectJoinAllExceptUser(Criteria $c, $con = null) 
    821597    { 
    822598        $c = clone $c; 
    823599 
    824         // Set the correct dbName if it has not been overridden 
    825         // $c->getDbName() will return the same object if not set to another value 
    826         // so == check is okay and faster 
    827         if ($c->getDbName() == Propel::getDefaultDB()) { 
     600                                if ($c->getDbName() == Propel::getDefaultDB()) { 
    828601            $c->setDbName(self::DATABASE_NAME); 
    829602        } 
     
    859632            for ($j=0, $resCount=count($results); $j < $resCount; $j++) { 
    860633                $temp_obj1 = $results[$j]; 
    861                 $temp_obj2 = $temp_obj1->getQuestion(); //CHECKME 
    862                 if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { 
     634                $temp_obj2 = $temp_obj1->getQuestion();                 if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { 
    863635                    $newObject = false; 
    864636                    $temp_obj2->addAnswer($obj1); 
     
    877649    } 
    878650 
    879     /** 
    880      * Returns the TableMap related to this peer. 
    881      * This method is not needed for general use but a specific application could have a need. 
    882      * @return TableMap 
    883      * @throws PropelException Any exceptions caught during processing will be 
    884      *       rethrown wrapped into a PropelException. 
    885      */ 
     651     
    886652    public static function getTableMap() 
    887653    { 
     
    889655    } 
    890656 
    891     /** 
    892      * The class that the Peer will make instances of. 
    893      * 
    894      * This uses a dot-path notation which is tranalted into a path 
    895      * relative to a location on the PHP include_path. 
    896      * (e.g. path.to.MyClass -> 'path/to/MyClass.php') 
    897      * 
    898      * @return string path.to.ClassName 
    899      */ 
     657     
    900658    public static function getOMClass() 
    901659    { 
     
    903661    } 
    904662 
    905     /** 
    906      * Method perform an INSERT on the database, given a Answer or Criteria object. 
    907      * 
    908      * @param mixed $values Criteria or Answer object containing data that is used to create the INSERT statement. 
    909      * @param Connection $con the connection to use 
    910      * @return mixed The new primary key. 
    911      * @throws PropelException Any exceptions caught during processing will be 
    912      *       rethrown wrapped into a PropelException. 
    913      */ 
     663     
    914664    public static function doInsert($values, $con = null) 
    915665    { 
     
    919669 
    920670        if ($values instanceof Criteria) { 
    921             $criteria = clone $values; // rename for clarity 
    922         } else { 
    923             $criteria = $values->buildCriteria(); // build Criteria from Answer object 
    924         } 
    925  
    926         $criteria->remove(AnswerPeer::ID); // remove pkey col since this table uses auto-increment 
    927  
    928  
    929         // Set the correct dbName 
    930         $criteria->setDbName(self::DATABASE_NAME); 
     671            $criteria = clone $values;      } else { 
     672            $criteria = $values->buildCriteria();       } 
     673 
     674        $criteria->remove(AnswerPeer::ID);  
     675 
     676                $criteria->setDbName(self::DATABASE_NAME); 
    931677 
    932678        try { 
    933             // use transaction because $criteria could contain info 
    934             // for more than one table (I guess, conceivably) 
    935             $con->begin(); 
     679                                    $con->begin(); 
    936680            $pk = BasePeer::doInsert($criteria, $con); 
    937681            $con->commit(); 
     
    944688    } 
    945689 
    946     /** 
    947      * Method perform an UPDATE on the database, given a Answer or Criteria object. 
    948      * 
    949      * @param mixed $values Criteria or Answer object containing data that is used to create the UPDATE statement. 
    950      * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). 
    951      * @return int The number of affected rows (if supported by underlying database driver). 
    952      * @throws PropelException Any exceptions caught during processing will be 
    953      *       rethrown wrapped into a PropelException. 
    954      */ 
     690     
    955691    public static function doUpdate($values, $con = null) 
    956692    { 
     
    962698 
    963699        if ($values instanceof Criteria) { 
    964             $criteria = clone $values; // rename for clarity 
    965  
     700            $criteria = clone $values;  
    966701            $comparison = $criteria->getComparison(AnswerPeer::ID); 
    967702            $selectCriteria->add(AnswerPeer::ID, $criteria->remove(AnswerPeer::ID), $comparison); 
    968703 
    969         } else { // $values is Answer object 
    970             $criteria = $values->buildCriteria(); // gets full criteria 
    971             $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) 
    972         } 
    973  
    974         // set the correct dbName 
    975         $criteria->setDbName(self::DATABASE_NAME); 
     704        } else {            $criteria = $values->buildCriteria();           $selectCriteria = $values->buildPkeyCriteria();         } 
     705 
     706                $criteria->setDbName(self::DATABASE_NAME); 
    976707 
    977708        return BasePeer::doUpdate($selectCriteria, $criteria, $con); 
    978709    } 
    979710 
    980     /** 
    981      * Method to DELETE all rows from the ask_answer table. 
    982      * 
    983      * @return int The number of affected rows (if supported by underlying database driver). 
    984      */ 
     711     
    985712    public static function doDeleteAll($con = null) 
    986713    { 
     
    988715            $con = Propel::getConnection(self::DATABASE_NAME); 
    989716        } 
    990         $affectedRows = 0; // initialize var to track total num of affected rows 
    991         try { 
    992             // use transaction because $criteria could contain info 
    993             // for more than one table or we could emulating ON DELETE CASCADE, etc. 
    994             $con->begin(); 
     717        $affectedRows = 0;      try { 
     718                                    $con->begin(); 
    995719            $affectedRows += BasePeer::doDeleteAll(AnswerPeer::TABLE_NAME, $con); 
    996720            $con->commit(); 
     
    1002726    } 
    1003727 
    1004     /** 
    1005      * Method perform a DELETE on the database, given a Answer or Criteria object OR a primary key value. 
    1006      * 
    1007      * @param mixed $values Criteria or Answer object or primary key or array of primary keys 
    1008      *              which is used to create the DELETE statement 
    1009      * @param Connection $con the connection to use 
    1010      * @return int  The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows 
    1011      *              if supported by native driver or if emulated using Propel. 
    1012      * @throws PropelException Any exceptions caught during processing will be 
    1013      *       rethrown wrapped into a PropelException. 
    1014      */ 
     728     
    1015729     public static function doDelete($values, $con = null) 
    1016730     { 
     
    1020734 
    1021735        if ($values instanceof Criteria) { 
    1022             $criteria = clone $values; // rename for clarity 
    1023         } elseif ($values instanceof Answer) { 
     736            $criteria = clone $values;      } elseif ($values instanceof Answer) { 
    1024737 
    1025738            $criteria = $values->buildPkeyCriteria(); 
    1026739        } else { 
    1027             // it must be the primary key 
    1028             $criteria = new Criteria(self::DATABASE_NAME); 
     740                        $criteria = new Criteria(self::DATABASE_NAME); 
    1029741            $criteria->add(AnswerPeer::ID, (array) $values, Criteria::IN); 
    1030742        } 
    1031743 
    1032         // Set the correct dbName 
    1033         $criteria->setDbName(self::DATABASE_NAME); 
    1034  
    1035         $affectedRows = 0; // initialize var to track total num of affected rows 
    1036  
     744                $criteria->setDbName(self::DATABASE_NAME); 
     745 
     746        $affectedRows = 0;  
    1037747        try { 
    1038             // use transaction because $criteria could contain info 
    1039             // for more than one table or we could emulating ON DELETE CASCADE, etc. 
    1040             $con->begin(); 
     748                                    $con->begin(); 
    1041749             
    1042750            $affectedRows += BasePeer::doDelete($criteria, $con); 
     
    1049757    } 
    1050758 
    1051     /** 
    1052      * Validates all modified columns of given Answer object. 
    1053      * If parameter $columns is either a single column name or an array of column names 
    1054      * than only those columns are validated. 
    1055      * 
    1056      * NOTICE: This does not apply to primary or foreign keys for now. 
    1057      * 
    1058      * @param Answer $obj The object to validate. 
    1059      * @param mixed $cols Column name or array of column names. 
    1060      * 
    1061      * @return mixed TRUE if all columns are valid or the error message of the first invalid column. 
    1062      */ 
     759     
    1063760    public static function doValidate(Answer $obj, $cols = null) 
    1064761    { 
     
    1095792    } 
    1096793 
    1097     /** 
    1098      * Retrieve a single object by pkey. 
    1099      * 
    1100      * @param mixed $pk the primary key. 
    1101      * @param Connection $con the connection to use 
    1102      * @return Answer 
    1103      */ 
     794     
    1104795    public static function retrieveByPK($pk, $con = null) 
    1105796    { 
     
    1114805 
    1115806        $v = AnswerPeer::doSelect($criteria, $con); 
    1116         return !empty($v) > 0 ? $v[0] : null; 
    1117     } 
    1118  
    1119     /** 
    1120      * Retrieve multiple objects by pkey. 
    1121      * 
    1122      * @param array $pks List of primary keys 
    1123      * @param Connection $con the connection to use 
    1124      * @throws PropelException Any exceptions caught during processing will be 
    1125      *       rethrown wrapped into a PropelException. 
    1126      */ 
     807 
     808        return !empty($v) > 0 ? $v[0] : null; 
     809    } 
     810 
     811     
    1127812    public static function retrieveByPKs($pks, $con = null) 
    1128813    { 
     
    1142827    } 
    1143828 
    1144 } // BaseAnswerPeer 
    1145  
    1146 // static code to register the map builder for this Peer with the main Propel class 
     829}  
    1147830if (Propel::isInit()) { 
    1148     // the MapBuilder classes register themselves with Propel during initialization 
    1149     // so we need to load them here. 
    1150     try { 
     831            try { 
    1151832        BaseAnswerPeer::getMapBuilder(); 
    1152833    } catch (Exception $e) { 
     
    1154835    } 
    1155836} else { 
    1156     // even if Propel is not yet initialized, the map builder class can be registered 
    1157     // now and then it will be loaded when Propel initializes. 
    1158     require_once 'model/map/AnswerMapBuilder.php'; 
    1159     Propel::registerMapBuilder('model.map.AnswerMapBuilder'); 
     837            require_once 'lib/model/map/AnswerMapBuilder.php'; 
     838    Propel::registerMapBuilder('lib.model.map.AnswerMapBuilder'); 
    1160839} 
  • trunk/lib/model/om/BaseInterest.php

    r74 r88  
    11<?php 
    22 
    3 require_once 'propel/om/BaseObject.php'; 
    4  
    5 require_once 'propel/om/Persistent.php'; 
    6  
    7  
    8 include_once 'propel/util/Criteria.php'; 
    9  
    10 include_once 'model/InterestPeer.php'; 
    11  
    12 /** 
    13  * Base class that represents a row from the 'ask_interest' table. 
    14  * 
    15  *  
    16  * 
    17  * @package model.om 
    18  */ 
     3 
    194abstract class BaseInterest extends BaseObject  implements Persistent { 
    205 
    216 
    22     /** 
    23      * The Peer class. 
    24      * Instance provides a convenient way of calling static methods on a class 
    25      * that calling code may not be able to identify. 
    26      * @var InterestPeer 
    27      */ 
     7     
     8    const DATABASE_NAME = 'symfony'; 
     9 
     10     
    2811    protected static $peer; 
    2912 
    3013 
    31     /** 
    32      * The value for the question_id field. 
    33      * @var int 
    34      */ 
     14     
    3515    protected $question_id; 
    3616 
    3717 
    38     /** 
    39      * The value for the user_id field. 
    40      * @var int 
    41      */ 
     18     
    4219    protected $user_id; 
    4320 
    4421 
    45     /** 
    46      * The value for the created_at field. 
    47      * @var int 
    48      */ 
     22     
    4923    protected $created_at; 
    5024 
    51     /** 
    52      * @var Question 
    53      */ 
     25     
    5426    protected $aQuestion; 
    5527 
    56     /** 
    57      * @var User 
    58      */ 
     28     
    5929    protected $aUser; 
    6030 
    61     /** 
    62      * Flag to prevent endless save loop, if this object is referenced 
    63      * by another object which falls in this transaction. 
    64      * @var boolean 
    65      */ 
     31     
    6632    protected $alreadyInSave = false; 
    6733 
    68     /** 
    69      * Flag to prevent endless validation loop, if this object is referenced 
    70      * by another object which falls in this transaction. 
    71      * @var boolean 
    72      */ 
     34     
    7335    protected $alreadyInValidation = false; 
    7436 
    75     /** 
    76      * Get the [question_id] column value. 
    77      *  
    78      * @return int 
    79      */ 
     37     
    8038    public function getQuestionId() 
    8139    { 
     
    8442    } 
    8543 
    86     /** 
    87      * Get the [user_id] column value. 
    88      *  
    89      * @return int 
    90      */ 
     44     
    9145    public function getUserId() 
    9246    { 
     
    9549    } 
    9650 
    97     /** 
    98      * Get the [optionally formatted] [created_at] column value. 
    99      *  
    100      * @param string $format The date/time format string (either date()-style or strftime()-style). 
    101      *                          If format is NULL, then the integer unix timestamp will be returned. 
    102      * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). 
    103      * @throws PropelException - if unable to convert the date/time to timestamp. 
    104      */ 
     51     
    10552    public function getCreatedAt($format = 'Y-m-d H:i:s') 
    10653    { 
     
    10956            return null; 
    11057        } elseif (!is_int($this->created_at)) { 
    111             // a non-timestamp value was set externally, so we convert it 
    112             $ts = strtotime($this->created_at); 
    113             if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE 
    114                 throw new PropelException("Unable to parse value of [created_at] as date/time value: " . var_export($this->created_at, true)); 
     58                        $ts = strtotime($this->created_at); 
     59            if ($ts === -1 || $ts === false) {              throw new PropelException("Unable to parse value of [created_at] as date/time value: " . var_export($this->created_at, true)); 
    11560            } 
    11661        } else { 
     
    12671    } 
    12772 
    128     /** 
    129      * Set the value of [question_id] column. 
    130      *  
    131      * @param int $v new value 
    132      * @return void 
    133      */ 
     73     
    13474    public function setQuestionId($v) 
    13575    { 
     
    14282        if ($this->aQuestion !== null && $this->aQuestion->getId() !== $v) { 
    14383            $this->aQuestion = null; 
    144         }        
    145  
    146     } // setQuestionId() 
    147  
    148     /** 
    149      * Set the value of [user_id] column. 
    150      *  
    151      * @param int $v new value 
    152      * @return void 
    153      */ 
     84        } 
     85 
     86    }  
     87     
    15488    public function setUserId($v) 
    15589    { 
     
    16296        if ($this->aUser !== null && $this->aUser->getId() !== $v) { 
    16397            $this->aUser = null; 
    164         }        
    165  
    166     } // setUserId() 
    167  
    168     /** 
    169      * Set the value of [created_at] column. 
    170      *  
    171      * @param int $v new value 
    172      * @return void 
    173      */ 
     98        } 
     99 
     100    }  
     101     
    174102    public function setCreatedAt($v) 
    175103    { 
     
    177105        if ($v !== null && !is_int($v)) { 
    178106            $ts = strtotime($v); 
    179             if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE 
    180                 throw new PropelException("Unable to parse date/time value for [created_at] from input: " . var_export($v, true)); 
     107            if ($ts === -1 || $ts === false) {              throw new PropelException("Unable to parse date/time value for [created_at] from input: " . var_export($v, true)); 
    181108            } 
    182109        } else { 
     
    188115        } 
    189116 
    190     } // setCreatedAt() 
    191  
    192     /** 
    193      * Hydrates (populates) the object variables with values from the database resultset. 
    194      * 
    195      * An offset (1-based "start column") is specified so that objects can be hydrated 
    196      * with a subset of the columns in the resultset rows.  This is needed, for example, 
    197      * for results of JOIN queries where the resultset row includes columns from two or 
    198      * more tables. 
    199      * 
    200      * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. 
    201      * @param int $startcol 1-based offset column which indicates which restultset column to start with. 
    202      * @return int next starting column 
    203      * @throws PropelException  - Any caught Exception will be rewrapped as a PropelException. 
    204      */ 
     117    }  
     118     
    205119    public function hydrate(ResultSet $rs, $startcol = 1) 
    206120    { 
     
    217131            $this->setNew(false); 
    218132 
    219             // FIXME - using NUM_COLUMNS may be clearer. 
    220             return $startcol + 3; // 3 = InterestPeer::NUM_COLUMNS - InterestPeer::NUM_LAZY_LOAD_COLUMNS). 
    221  
     133                        return $startcol + 3;  
    222134        } catch (Exception $e) { 
    223135            throw new PropelException("Error populating Interest object", $e); 
     
    225137    } 
    226138 
    227     /** 
    228      * Removes this object from datastore and sets delete attribute. 
    229      * 
    230      * @param Connection $con 
    231      * @return void 
    232      * @throws PropelException 
    233      * @see BaseObject::setDeleted() 
    234      * @see BaseObject::isDeleted() 
    235      */ 
     139     
    236140    public function delete($con = null) 
    237141    { 
     
    255159    } 
    256160 
    257     /** 
    258      * Stores the object in the database.  If the object is new, 
    259      * it inserts it; otherwise an update is performed.  This method 
    260      * wraps the doSave() worker method in a transaction. 
    261      * 
    262      * @param Connection $con 
    263      * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. 
    264      * @throws PropelException 
    265      * @see doSave() 
    266      */ 
     161     
    267162    public function save($con = null) 
    268163    { 
    269     if ($this->isNew()
     164    if ($this->isNew() && !$this->isColumnModified(InterestPeer::CREATED_AT)
    270165    { 
    271166      $this->setCreatedAt(time()); 
     
    279174            $con = Propel::getConnection(InterestPeer::DATABASE_NAME); 
    280175        } 
    281          
     176 
    282177        try { 
    283178            $con->begin(); 
     
    291186    } 
    292187 
    293     /** 
    294      * Stores the object in the database. 
    295      *  
    296      * If the object is new, it inserts it; otherwise an update is performed. 
    297      * All related objects are also updated in this method. 
    298      * 
    299      * @param Connection $con 
    300      * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. 
    301      * @throws PropelException 
    302      * @see save() 
    303      */ 
     188     
    304189    protected function doSave($con) 
    305190    { 
    306         $affectedRows = 0; // initialize var to track total num of affected rows     
    307         if (!$this->alreadyInSave) { 
     191        $affectedRows = 0;      if (!$this->alreadyInSave) { 
    308192            $this->alreadyInSave = true; 
    309193 
    310194 
    311             // We call the save method on the following object(s) if they 
    312             // were passed to this object by their coresponding set 
    313             // method.  This object relates to these object(s) by a 
    314             // foreign key reference. 
    315  
     195                                                 
    316196            if ($this->aQuestion !== null) { 
    317197                if ($this->aQuestion->isModified()) { 
     
    327207                $this->setUser($this->aUser); 
    328208            } 
    329      
    330  
    331             // If this object has been modified, then save it to the database. 
    332             if ($this->isModified()) { 
     209 
     210 
     211                        if ($this->isModified()) { 
    333212                if ($this->isNew()) { 
    334213                    $pk = InterestPeer::doInsert($this, $con); 
    335                     $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which  
    336                                          // should always be true here (even though technically  
    337                                          // BasePeer::doInsert() can insert multiple rows). 
    338  
     214                    $affectedRows += 1;                                                                                   
    339215                    $this->setNew(false); 
    340216                } else { 
    341217                    $affectedRows += InterestPeer::doUpdate($this, $con); 
    342218                } 
    343                 $this->resetModified(); // [HL] After being saved an object is no longer 'modified' 
    344             } 
     219                $this->resetModified();             } 
    345220 
    346221            $this->alreadyInSave = false; 
    347222        } 
    348223        return $affectedRows; 
    349     } // doSave() 
    350  
    351     /** 
    352      * Array of ValidationFailed objects. 
    353      * @var array ValidationFailed[] 
    354      */ 
     224    }  
     225     
    355226    protected $validationFailures = array(); 
    356227 
    357     /** 
    358      * Gets any ValidationFailed objects that resulted from last call to validate(). 
    359      * 
    360      * 
    361      * @return array ValidationFailed[] 
    362      * @see validate() 
    363      */ 
     228     
    364229    public function getValidationFailures() 
    365230    { 
     
    367232    } 
    368233 
    369     /** 
    370      * Validates the objects modified field values and all objects related to this table. 
    371      * 
    372      * If $columns is either a column name or an array of column names 
    373      * only those columns are validated. 
    374      * 
    375      * @param mixed $columns Column name or an array of column names. 
    376      * @return boolean Whether all columns pass validation. 
    377      * @see doValidate() 
    378      * @see getValidationFailures() 
    379      */ 
     234     
    380235    public function validate($columns = null) 
    381236    { 
     
    390245    } 
    391246 
    392     /** 
    393      * This function performs the validation work for complex object models. 
    394      * 
    395      * In addition to checking the current object, all related objects will 
    396      * also be validated.  If all pass then <code>true</code> is returned; otherwise 
    397      * an aggreagated array of ValidationFailed objects will be returned. 
    398      * 
    399      * @param array $columns Array of column names to validate. 
    400      * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. 
    401      */ 
     247     
    402248    protected function doValidate($columns = null) 
    403249    { 
     
    409255 
    410256 
    411             // We call the validate method on the following object(s) if they 
    412             // were passed to this object by their coresponding set 
    413             // method.  This object relates to these object(s) by a 
    414             // foreign key reference. 
    415  
     257                                                 
    416258            if ($this->aQuestion !== null) { 
    417259                if (!$this->aQuestion->validate($columns)) { 
     
    439281    } 
    440282 
    441     /** 
    442      * Retrieves a field from the object by name passed in as a string. 
    443      * 
    444      * @param string $name name 
    445      * @param string $type The type of fieldname the $name is of: 
    446      *                     one of the class type constants TYPE_PHPNAME, 
    447      *                     TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM 
    448      * @return mixed Value of field. 
    449      */ 
     283     
    450284    public function getByName($name, $type = BasePeer::TYPE_PHPNAME) 
    451285    { 
     
    454288    } 
    455289 
    456     /** 
    457      * Retrieves a field from the object by Position as specified in the xml schema. 
    458      * Zero-based. 
    459      * 
    460      * @param int $pos position in xml schema 
    461      * @return mixed Value of field at $pos 
    462      */ 
     290     
    463291    public function getByPosition($pos) 
    464292    { 
     
    476304                return null; 
    477305                break; 
    478         } // switch() 
    479     } 
    480  
    481     /** 
    482      * Exports the object as an array. 
    483      * 
    484      * You can specify the key type of the array by passing one of the class 
    485      * type constants. 
    486      * 
    487      * @param string $keyType One of the class type constants TYPE_PHPNAME, 
    488      *                        TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM 
    489      * @return an associative array containing the field names (as keys) and field values 
    490      */ 
     306        }   } 
     307 
     308     
    491309    public function toArray($keyType = BasePeer::TYPE_PHPNAME) 
    492310    { 
     
    500318    } 
    501319 
    502     /** 
    503      * Sets a field from the object by name passed in as a string. 
    504      * 
    505      * @param string $name peer name 
    506      * @param mixed $value field value 
    507      * @param string $type The type of fieldname the $name is of: 
    508      *                     one of the class type constants TYPE_PHPNAME, 
    509      *                     TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM 
    510      * @return void 
    511      */ 
     320     
    512321    public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) 
    513322    { 
     
    516325    } 
    517326 
    518     /** 
    519      * Sets a field from the object by Position as specified in the xml schema. 
    520      * Zero-based. 
    521      * 
    522      * @param int $pos position in xml schema 
    523      * @param mixed $value field value 
    524      * @return void 
    525      */ 
     327     
    526328    public function setByPosition($pos, $value) 
    527329    { 
     
    536338                $this->setCreatedAt($value); 
    537339                break; 
    538         } // switch() 
    539     } 
    540  
    541     /** 
    542      * Populates the object using an array. 
    543      * 
    544      * This is particularly useful when populating an object from one of the 
    545      * request arrays (e.g. $_POST).  This method goes through the column 
    546      * names, checking to see whether a matching key exists in populated 
    547      * array. If so the setByName() method is called for that column. 
    548      * 
    549      * You can specify the key type of the array by additionally passing one 
    550      * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, 
    551      * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') 
    552      * 
    553      * @param array  $arr     An array to populate the object from. 
    554      * @param string $keyType The type of keys the array uses. 
    555      * @return void 
    556      */ 
     340        }   } 
     341 
     342     
    557343    public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) 
    558344    { 
     
    564350    } 
    565351 
    566     /** 
    567      * Build a Criteria object containing the values of all modified columns in this object. 
    568      * 
    569      * @return Criteria The Criteria object containing all modified values. 
    570      */ 
     352     
    571353    public function buildCriteria() 
    572354    { 
     
    580362    } 
    581363 
    582     /** 
    583      * Builds a Criteria object containing the primary key for this object. 
    584      * 
    585      * Unlike buildCriteria() this method includes the primary key values regardless 
    586      * of whether or not they have been modified. 
    587      * 
    588      * @return Criteria The Criteria object containing value(s) for primary key(s). 
    589      */ 
     364     
    590365    public function buildPkeyCriteria() 
    591366    { 
     
    598373    } 
    599374 
    600     /** 
    601      * Returns the composite primary key for this object. 
    602      * The array elements will be in same order as specified in XML. 
    603      * @return array 
    604      */ 
     375     
    605376    public function getPrimaryKey() 
    606377    { 
     
    614385    } 
    615386 
    616     /** 
    617      * Set the [composite] primary key. 
    618      * 
    619      * @param array $keys The elements of the composite key (order must match the order in XML file). 
    620      * @return void 
    621      */ 
     387     
    622388    public function setPrimaryKey($keys) 
    623389    { 
     
    629395    } 
    630396 
    631     /** 
    632      * Sets contents of passed object to values from current object. 
    633      *  
    634      * If desired, this method can also make copies of all associated (fkey referrers) 
    635      * objects. 
    636      * 
    637      * @param object $copyObj An object of Interest (or compatible) type. 
    638      * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. 
    639      * @throws PropelException 
    640      */ 
     397     
    641398    public function copyInto($copyObj, $deepCopy = false) 
    642399    { 
     
    647404        $copyObj->setNew(true); 
    648405 
    649         $copyObj->setQuestionId(NULL); // this is a pkey column, so set to default value 
    650  
    651         $copyObj->setUserId(NULL); // this is a pkey column, so set to default value 
    652  
    653     } 
    654  
    655     /** 
    656      * Makes a copy of this object that will be inserted as a new row in table when saved. 
    657      * It creates a new object filling in the simple attributes, but skipping any primary 
    658      * keys that are defined for the table. 
    659      *  
    660      * If desired, this method can also make copies of all associated (fkey referrers) 
    661      * objects. 
    662      * 
    663      * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. 
    664      * @return Interest Clone of current object. 
    665      * @throws PropelException 
    666      */ 
     406        $copyObj->setQuestionId(NULL);  
     407        $copyObj->setUserId(NULL);  
     408    } 
     409 
     410     
    667411    public function copy($deepCopy = false) 
    668412    { 
    669         // we use get_class(), because this might be a subclass 
    670         $clazz = get_class($this); 
     413                $clazz = get_class($this); 
    671414        $copyObj = new $clazz(); 
    672415        $this->copyInto($copyObj, $deepCopy); 
     
    674417    } 
    675418 
    676     /** 
    677      * Returns a peer instance associated with this om. 
    678      * 
    679      * Since Peer classes are not to have any instance attributes, this method returns the 
    680      * same instance for all member of this class. The method could therefore 
    681      * be static, but this would prevent one from overriding the behavior. 
    682      * 
    683      * @return InterestPeer 
    684      */ 
     419     
    685420    public function getPeer() 
    686421    { 
     
    691426    } 
    692427 
    693     /** 
    694      * Declares an association between this object and a Question object. 
    695      * 
    696      * @param Question $v 
    697      * @return void 
    698      * @throws PropelException 
    699      */ 
     428     
    700429    public function setQuestion($v) 
    701430    { 
     
    713442 
    714443 
    715     /** 
    716      * Get the associated Question object 
    717      * 
    718      * @param Connection Optional Connection object. 
    719      * @return Question The associated Question object. 
    720      * @throws PropelException 
    721      */ 
     444     
    722445    public function getQuestion($con = null) 
    723446    { 
    724         // include the related Peer class 
    725         include_once 'model/om/BaseQuestionPeer.php'; 
     447                include_once 'lib/model/om/BaseQuestionPeer.php'; 
    726448 
    727449        if ($this->aQuestion === null && ($this->question_id !== null)) { 
    728450 
    729451            $this->aQuestion = QuestionPeer::retrieveByPK($this->question_id, $con); 
    730                      
    731             /* The following can be used instead of the line above to 
    732                guarantee the related object contains a reference 
    733                to this object, but this level of coupling 
    734                may be undesirable in many circumstances. 
    735                As it can lead to a db query with many results that may 
    736                never be used. 
    737                $obj = QuestionPeer::retrieveByPK($this->question_id, $con); 
    738                $obj->addQuestions($this); 
    739              */ 
     452 
     453             
    740454        } 
    741455        return $this->aQuestion; 
    742456    } 
    743457 
    744     /** 
    745      * Declares an association between this object and a User object. 
    746      * 
    747      * @param User $v 
    748      * @return void 
    749      * @throws PropelException 
    750      */ 
     458     
    751459    public function setUser($v) 
    752460    { 
     
    764472 
    765473 
    766     /** 
    767      * Get the associated User object 
    768      * 
    769      * @param Connection Optional Connection object. 
    770      * @return User The associated User object. 
    771      * @throws PropelException 
    772      */ 
     474     
    773475    public function getUser($con = null) 
    774476    { 
    775         // include the related Peer class 
    776         include_once 'model/om/BaseUserPeer.php'; 
     477                include_once 'lib/model/om/BaseUserPeer.php'; 
    777478 
    778479        if ($this->aUser === null && ($this->user_id !== null)) { 
    779480 
    780481            $this->aUser = UserPeer::retrieveByPK($this->user_id, $con); 
    781                      
    782             /* The following can be used instead of the line above to 
    783                guarantee the related object contains a reference 
    784                to this object, but this level of coupling 
    785                may be undesirable in many circumstances. 
    786                As it can lead to a db query with many results that may 
    787                never be used. 
    788                $obj = UserPeer::retrieveByPK($this->user_id, $con); 
    789                $obj->addUsers($this); 
    790              */ 
     482 
     483             
    791484        } 
    792485        return $this->aUser; 
    793486    } 
    794487 
    795 } // BaseInterest 
     488}  
  • trunk/lib/model/om/BaseInterestPeer.php

    r74 r88  
    11<?php 
    22 
    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  
    8 /** 
    9  * Base static class for performing query and update operations on the 'ask_interest' table. 
    10  * 
    11  *  
    12  * 
    13  * @package model.om 
    14  */ 
     3 
    154abstract class BaseInterestPeer { 
    165 
    17     /** the default database name for this class */ 
     6     
    187    const DATABASE_NAME = 'symfony'; 
    198 
    20     /** the table name for this class */ 
     9     
    2110    const TABLE_NAME = 'ask_interest'; 
    2211 
    23     /** A class that can be returned by this peer. */ 
    24     const CLASS_DEFAULT = 'model.Interest'; 
    25  
    26     /** The total number of columns. */ 
     12     
     13    const CLASS_DEFAULT = 'lib.model.Interest'; 
     14 
     15     
    2716    const NUM_COLUMNS = 3; 
    2817 
    29     /** The number of lazy-loaded columns. */ 
     18     
    3019    const NUM_LAZY_LOAD_COLUMNS = 0; 
    3120 
    3221 
    33     /** the column name for the QUESTION_ID field */ 
     22     
    3423    const QUESTION_ID = 'ask_interest.QUESTION_ID'; 
    3524 
    36     /** the column name for the USER_ID field */ 
     25     
    3726    const USER_ID = 'ask_interest.USER_ID'; 
    3827 
    39     /** the column name for the CREATED_AT field */ 
     28     
    4029    const CREATED_AT = 'ask_interest.CREATED_AT'; 
    4130 
    42     /** The PHP to DB Name Mapping */ 
     31     
    4332    private static $phpNameMap = null; 
    4433 
    4534 
    46     /** 
    47      * holds an array of fieldnames 
    48      * 
    49      * first dimension keys are the type constants 
    50      * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' 
    51      */ 
     35     
    5236    private static $fieldNames = array ( 
    5337        BasePeer::TYPE_PHPNAME => array ('QuestionId', 'UserId', 'CreatedAt', ), 
     
    5741    ); 
    5842 
    59     /** 
    60      * holds an array of keys for quick access to the fieldnames array 
    61      * 
    62      * first dimension keys are the type constants 
    63      * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 
    64      */ 
     43     
    6544    private static $fieldKeys = array ( 
    6645        BasePeer::TYPE_PHPNAME => array ('QuestionId' => 0, 'UserId' => 1, 'CreatedAt' => 2, ), 
     
    7049    ); 
    7150 
    72     /** 
    73      * @return MapBuilder the map builder for this peer 
    74      * @throws PropelException Any exceptions caught during processing will be 
    75      *       rethrown wrapped into a PropelException. 
    76      */ 
     51     
    7752    public static function getMapBuilder() 
    7853    { 
    79         include_once 'model/map/InterestMapBuilder.php'; 
    80         return BasePeer::getMapBuilder('model.map.InterestMapBuilder'); 
    81     } 
    82     /** 
    83      * Gets a map (hash) of PHP names to DB column names. 
    84      * 
    85      * @return array The PHP to DB name map for this peer 
    86      * @throws PropelException Any exceptions caught during processing will be 
    87      *       rethrown wrapped into a PropelException. 
    88      * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. 
    89      */ 
     54        include_once 'lib/model/map/InterestMapBuilder.php'; 
     55        return BasePeer::getMapBuilder('lib.model.map.InterestMapBuilder'); 
     56    } 
     57     
    9058    public static function getPhpNameMap() 
    9159    { 
     
    10169        return self::$phpNameMap; 
    10270    } 
    103     /** 
    104      * Translates a fieldname to another type 
    105      * 
    106      * @param string $name field name 
    107      * @param string $fromType One of the class type constants TYPE_PHPNAME, 
    108      *                         TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM 
    109      * @param string $toType   One of the class type constants 
    110      * @return string translated name of the field. 
    111      */ 
     71     
    11272    static public function translateFieldName($name, $fromType, $toType) 
    11373    { 
     
    12080    } 
    12181 
    122     /** 
    123      * Returns an array of of field names. 
    124      * 
    125      * @param  string $type The type of fieldnames to return: 
    126      *                      One of the class type constants TYPE_PHPNAME, 
    127      *                      TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM 
    128      * @return array A list of field names 
    129      */ 
     82     
    13083 
    13184    static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) 
     
    13790    } 
    13891 
    139     /** 
    140      * Convenience method which changes table.column to alias.column. 
    141      * 
    142      * Using this method you can maintain SQL abstraction while using column aliases. 
    143      * <code> 
    144      *      $c->addAlias("alias1", TablePeer::TABLE_NAME); 
    145      *      $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); 
    146      * </code> 
    147      * @param string $alias The alias for the current table. 
    148      * @param string $column The column name for current table. (i.e. InterestPeer::COLUMN_NAME). 
    149      * @return string 
    150      */ 
     92     
    15193    public static function alias($alias, $column) 
    15294    { 
     
    15496    } 
    15597 
    156     /** 
    157      * Add all the columns needed to create a new object. 
    158      * 
    159      * Note: any columns that were marked with lazyLoad="true" in the 
    160      * XML schema will not be added to the select list and only loaded 
    161      * on demand. 
    162      * 
    163      * @param criteria object containing the columns to add. 
    164      * @throws PropelException Any exceptions caught during processing will be 
    165      *       rethrown wrapped into a PropelException. 
    166      */ 
     98     
    16799    public static function addSelectColumns(Criteria $criteria) 
    168100    { 
     
    179111    const COUNT_DISTINCT = 'COUNT(DISTINCT ask_interest.QUESTION_ID)'; 
    180112 
    181     /** 
    182      * Returns the number of rows matching criteria. 
    183      * 
    184      * @param Criteria $criteria 
    185      * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). 
    186      * @param Connection $con 
    187      * @return int Number of matching rows. 
    188      */ 
     113     
    189114    public static function doCount(Criteria $criteria, $distinct = false, $con = null) 
    190115    { 
    191         // we're going to modify criteria, so copy it first 
    192         $criteria = clone $criteria; 
    193  
    194         // clear out anything that might confuse the ORDER BY clause 
    195         $criteria->clearSelectColumns()->clearOrderByColumns(); 
     116                $criteria = clone $criteria; 
     117 
     118                $criteria->clearSelectColumns()->clearOrderByColumns(); 
    196119        if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { 
    197120            $criteria->addSelectColumn(InterestPeer::COUNT_DISTINCT); 
     
    200123        } 
    201124 
    202         // just in case we're grouping: add those columns to the select statement 
    203         foreach($criteria->getGroupByColumns() as $column) 
     125                foreach($criteria->getGroupByColumns() as $column) 
    204126        { 
    205127            $criteria->addSelectColumn($column); 
     
    210132            return $rs->getInt(1); 
    211133        } else { 
    212             // no rows returned; we infer that means 0 matches. 
    213             return 0; 
    214         } 
    215     } 
    216     /** 
    217      * Method to select one object from the DB. 
    218      * 
    219      * @param Criteria $criteria object used to create the SELECT statement. 
    220      * @param Connection $con 
    221      * @return Interest 
    222      * @throws PropelException Any exceptions caught during processing will be 
    223      *       rethrown wrapped into a PropelException. 
    224      */ 
     134                        return 0; 
     135        } 
     136    } 
     137     
    225138    public static function doSelectOne(Criteria $criteria, $con = null) 
    226139    { 
     
    233146        return null; 
    234147    } 
    235     /** 
    236      * Method to do selects. 
    237      * 
    238      * @param Criteria $criteria The Criteria object used to build the SELECT statement. 
    239      * @param Connection $con 
    240      * @return array Array of selected Objects 
    241      * @throws PropelException Any exceptions caught during processing will be 
    242      *       rethrown wrapped into a PropelException. 
    243      */ 
     148     
    244149    public static function doSelect(Criteria $criteria, $con = null) 
    245150    { 
    246151        return InterestPeer::populateObjects(InterestPeer::doSelectRS($criteria, $con)); 
    247152    } 
    248     /** 
    249      * Prepares the Criteria object and uses the parent doSelect() 
    250      * method to get a ResultSet. 
    251      * 
    252      * Use this method directly if you want to just get the resultset 
    253      * (instead of an array of objects). 
    254      * 
    255      * @param Criteria $criteria The Criteria object used to build the SELECT statement. 
    256      * @param Connection $con the connection to use 
    257      * @throws PropelException Any exceptions caught during processing will be 
    258      *       rethrown wrapped into a PropelException. 
    259      * @return ResultSet The resultset object with numerically-indexed fields. 
    260      * @see BasePeer::doSelect() 
    261      */ 
     153     
    262154    public static function doSelectRS(Criteria $criteria, $con = null) 
    263155    { 
     
    271163        } 
    272164 
    273         // Set the correct dbName 
    274         $criteria->setDbName(self::DATABASE_NAME); 
    275  
    276         // BasePeer returns a Creole ResultSet, set to return 
    277         // rows indexed numerically. 
    278         return BasePeer::doSelect($criteria, $con); 
    279     } 
    280     /** 
    281      * The returned array will contain objects of the default type or 
    282      * objects that inherit from the default. 
    283      * 
    284      * @throws PropelException Any exceptions caught during processing will be 
    285      *       rethrown wrapped into a PropelException. 
    286      */ 
     165                $criteria->setDbName(self::DATABASE_NAME); 
     166 
     167                        return BasePeer::doSelect($criteria, $con); 
     168    } 
     169     
    287170    public static function populateObjects(ResultSet $rs) 
    288171    { 
    289172        $results = array(); 
    290173     
    291         // set the class once to avoid overhead in the loop 
    292         $cls = InterestPeer::getOMClass(); 
     174                $cls = InterestPeer::getOMClass(); 
    293175        $cls = Propel::import($cls); 
    294         // populate the object(s) 
    295         while($rs->next()) { 
     176                while($rs->next()) { 
    296177         
    297178            $obj = new $cls(); 
     
    303184    } 
    304185 
    305     /** 
    306      * Returns the number of rows matching criteria, joining the related Question table 
    307      * 
    308      * @param Criteria $c 
    309      * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). 
    310      * @param Connection $con 
    311      * @return int Number of matching rows. 
    312      */ 
     186     
    313187    public static function doCountJoinQuestion(Criteria $criteria, $distinct = false, $con = null) 
    314188    { 
    315         // we're going to modify criteria, so copy it first 
    316         $criteria = clone $criteria; 
    317          
    318         // clear out anything that might confuse the ORDER BY clause 
    319         $criteria->clearSelectColumns()->clearOrderByColumns(); 
     189                $criteria = clone $criteria; 
     190         
     191                $criteria->clearSelectColumns()->clearOrderByColumns(); 
    320192        if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { 
    321193            $criteria->addSelectColumn(InterestPeer::COUNT_DISTINCT); 
     
    324196        } 
    325197         
    326         // just in case we're grouping: add those columns to the select statement 
    327         foreach($criteria->getGroupByColumns() as $column) 
     198                foreach($criteria->getGroupByColumns() as $column) 
    328199        { 
    329200            $criteria->addSelectColumn($column); 
     
    336207            return $rs->getInt(1); 
    337208        } else { 
    338             // no rows returned; we infer that means 0 matches. 
    339             return 0; 
    340         } 
    341     } 
    342  
    343  
    344     /** 
    345      * Returns the number of rows matching criteria, joining the related User table 
    346      * 
    347      * @param Criteria $c 
    348      * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). 
    349      * @param Connection $con 
    350      * @return int Number of matching rows. 
    351      */ 
     209                        return 0; 
     210        } 
     211    } 
     212 
     213 
     214     
    352215    public static function doCountJoinUser(Criteria $criteria, $distinct = false, $con = null) 
    353216    { 
    354         // we're going to modify criteria, so copy it first 
    355         $criteria = clone $criteria; 
    356          
    357         // clear out anything that might confuse the ORDER BY clause 
    358         $criteria->clearSelectColumns()->clearOrderByColumns(); 
     217                $criteria = clone $criteria; 
     218         
     219                $criteria->clearSelectColumns()->clearOrderByColumns(); 
    359220        if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { 
    360221            $criteria->addSelectColumn(InterestPeer::COUNT_DISTINCT); 
     
    363224        } 
    364225         
    365         // just in case we're grouping: add those columns to the select statement 
    366         foreach($criteria->getGroupByColumns() as $column) 
     226                foreach($criteria->getGroupByColumns() as $column) 
    367227        { 
    368228            $criteria->addSelectColumn($column); 
     
    375235            return $rs->getInt(1); 
    376236        } else { 
    377             // no rows returned; we infer that means 0 matches. 
    378             return 0; 
    379         } 
    380     } 
    381  
    382  
    383     /** 
    384      * Selects a collection of Interest objects pre-filled with their Question objects. 
    385      * 
    386      * @return array Array of Interest objects. 
    387      * @throws PropelException Any exceptions caught during processing will be 
    388      *       rethrown wrapped into a PropelException. 
    389      */ 
     237                        return 0; 
     238        } 
     239    } 
     240 
     241 
     242     
    390243    public static function doSelectJoinQuestion(Criteria $c, $con = null) 
    391244    { 
    392245        $c = clone $c; 
    393246 
    394         // Set the correct dbName if it has not been overridden 
    395         if ($c->getDbName() == Propel::getDefaultDB()) { 
     247                if ($c->getDbName() == Propel::getDefaultDB()) { 
    396248            $c->setDbName(self::DATABASE_NAME); 
    397249        } 
     
    421273            $newObject = true; 
    422274            foreach($results as $temp_obj1) { 
    423                 $temp_obj2 = $temp_obj1->getQuestion(); //CHECKME 
    424                 if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { 
     275                $temp_obj2 = $temp_obj1->getQuestion();                 if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { 
    425276                    $newObject = false; 
    426                     // e.g. $author->addBookRelatedByBookId() 
    427                     $temp_obj2->addInterest($obj1); //CHECKME 
    428                     break; 
     277                                        $temp_obj2->addInterest($obj1);                     break; 
    429278                } 
    430279            } 
    431280            if ($newObject) { 
    432281                $obj2->initInterests(); 
    433                 $obj2->addInterest($obj1); //CHECKME 
    434             } 
     282                $obj2->addInterest($obj1);          } 
    435283            $results[] = $obj1; 
    436284        } 
     
    439287 
    440288 
    441     /** 
    442      * Selects a collection of Interest objects pre-filled with their User objects. 
    443      * 
    444      * @return array Array of Interest objects. 
    445      * @throws PropelException Any exceptions caught during processing will be 
    446      *       rethrown wrapped into a PropelException. 
    447      */ 
     289     
    448290    public static function doSelectJoinUser(Criteria $c, $con = null) 
    449291    { 
    450292        $c = clone $c; 
    451293 
    452         // Set the correct dbName if it has not been overridden 
    453         if ($c->getDbName() == Propel::getDefaultDB()) { 
     294                if ($c->getDbName() == Propel::getDefaultDB()) { 
    454295            $c->setDbName(self::DATABASE_NAME); 
    455296        } 
     
    479320            $newObject = true; 
    480321            foreach($results as $temp_obj1) { 
    481                 $temp_obj2 = $temp_obj1->getUser(); //CHECKME 
    482                 if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { 
     322                $temp_obj2 = $temp_obj1->getUser();                 if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { 
    483323                    $newObject = false; 
    484                     // e.g. $author->addBookRelatedByBookId() 
    485                     $temp_obj2->addInterest($obj1); //CHECKME 
    486                     break; 
     324                                        $temp_obj2->addInterest($obj1);                     break; 
    487325                } 
    488326            } 
    489327            if ($newObject) { 
    490328                $obj2->initInterests(); 
    491                 $obj2->addInterest($obj1); //CHECKME 
    492             } 
     329                $obj2->addInterest($obj1);          } 
    493330            $results[] = $obj1; 
    494331        } 
     
    497334 
    498335 
    499     /** 
    500      * Returns the number of rows matching criteria, joining all related tables 
    501      * 
    502      * @param Criteria $c 
    503      * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). 
    504      * @param Connection $con 
    505      * @return int Number of matching rows. 
    506      */ 
     336     
    507337    public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) 
    508338    { 
    509339        $criteria = clone $criteria; 
    510340 
    511         // clear out anything that might confuse the ORDER BY clause 
    512         $criteria->clearSelectColumns()->clearOrderByColumns(); 
     341                $criteria->clearSelectColumns()->clearOrderByColumns(); 
    513342        if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { 
    514343            $criteria->addSelectColumn(InterestPeer::COUNT_DISTINCT); 
     
    517346        } 
    518347         
    519         // just in case we're grouping: add those columns to the select statement 
    520         foreach($criteria->getGroupByColumns() as $column) 
     348                foreach($criteria->getGroupByColumns() as $column) 
    521349        { 
    522350            $criteria->addSelectColumn($column); 
     
    531359            return $rs->getInt(1); 
    532360        } else { 
    533             // no rows returned; we infer that means 0 matches. 
    534             return 0; 
    535         } 
    536     } 
    537  
    538  
    539     /** 
    540      * Selects a collection of Interest objects pre-filled with all related objects. 
    541      * 
    542      * @return array Array of Interest objects. 
    543      * @throws PropelException Any exceptions caught during processing will be 
    544      *       rethrown wrapped into a PropelException. 
    545      */ 
     361                        return 0; 
     362        } 
     363    } 
     364 
     365 
     366     
    546367    public static function doSelectJoinAll(Criteria $c, $con = null) 
    547368    { 
    548369        $c = clone $c; 
    549370 
    550         // Set the correct dbName if it has not been overridden 
    551         if ($c->getDbName() == Propel::getDefaultDB()) { 
     371                if ($c->getDbName() == Propel::getDefaultDB()) { 
    552372            $c->setDbName(self::DATABASE_NAME); 
    553373        } 
     
    579399 
    580400                 
    581                 // Add objects for joined Question rows 
    582      
     401                     
    583402            $omClass = QuestionPeer::getOMClass(); 
    584403 
     
    591410            for ($j=0, $resCount=count($results); $j < $resCount; $j++) { 
    592411                $temp_obj1 = $results[$j]; 
    593                 $temp_obj2 = $temp_obj1->getQuestion(); // CHECKME 
    594                 if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { 
     412                $temp_obj2 = $temp_obj1->getQuestion();                 if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { 
    595413                    $newObject = false; 
    596                     $temp_obj2->addInterest($obj1); // CHECKME 
    597                     break; 
     414                    $temp_obj2->addInterest($obj1);                     break; 
    598415                } 
    599416            } 
     
    605422 
    606423                 
    607                 // Add objects for joined User rows 
    608      
     424                     
    609425            $omClass = UserPeer::getOMClass(); 
    610426 
     
    617433            for ($j=0, $resCount=count($results); $j < $resCount; $j++) { 
    618434                $temp_obj1 = $results[$j]; 
    619                 $temp_obj3 = $temp_obj1->getUser(); // CHECKME 
    620                 if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { 
     435                $temp_obj3 = $temp_obj1->getUser();                 if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { 
    621436                    $newObject = false; 
    622                     $temp_obj3->addInterest($obj1); // CHECKME 
    623                     break; 
     437                    $temp_obj3->addInterest($obj1);                     break; 
    624438                } 
    625439            } 
     
    636450 
    637451 
    638     /** 
    639      * Returns the number of rows matching criteria, joining the related Question table 
    640      * 
    641      * @param Criteria $c 
    642      * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). 
    643      * @param Connection $con 
    644      * @return int Number of matching rows. 
    645      */ 
     452     
    646453    public static function doCountJoinAllExceptQuestion(Criteria $criteria, $distinct = false, $con = null) 
    647454    { 
    648         // we're going to modify criteria, so copy it first 
    649         $criteria = clone $criteria; 
    650          
    651         // clear out anything that might confuse the ORDER BY clause 
    652         $criteria->clearSelectColumns()->clearOrderByColumns(); 
     455                $criteria = clone $criteria; 
     456         
     457                $criteria->clearSelectColumns()->clearOrderByColumns(); 
    653458        if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { 
    654459            $criteria->addSelectColumn(InterestPeer::COUNT_DISTINCT); 
     
    657462        } 
    658463         
    659         // just in case we're grouping: add those columns to the select statement 
    660         foreach($criteria->getGroupByColumns() as $column) 
     464                foreach($criteria->getGroupByColumns() as $column) 
    661465        { 
    662466            $criteria->addSelectColumn($column); 
     
    669473            return $rs->getInt(1); 
    670474        } else { 
    671             // no rows returned; we infer that means 0 matches. 
    672             return 0; 
    673         } 
    674     } 
    675  
    676  
    677     /** 
    678      * Returns the number of rows matching criteria, joining the related User table 
    679      * 
    680      * @param Criteria $c 
    681      * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). 
    682      * @param Connection $con 
    683      * @return int Number of matching rows. 
    684      */ 
     475                        return 0; 
     476        } 
     477    } 
     478 
     479 
     480     
    685481    public static function doCountJoinAllExceptUser(Criteria $criteria, $distinct = false, $con = null) 
    686482    { 
    687         // we're going to modify criteria, so copy it first 
    688         $criteria = clone $criteria; 
    689          
    690         // clear out anything that might confuse the ORDER BY clause 
    691         $criteria->clearSelectColumns()->clearOrderByColumns(); 
     483                $criteria = clone $criteria; 
     484         
     485                $criteria->clearSelectColumns()->clearOrderByColumns(); 
    692486        if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { 
    693487            $criteria->addSelectColumn(InterestPeer::COUNT_DISTINCT); 
     
    696490        } 
    697491         
    698         // just in case we're grouping: add those columns to the select statement 
    699         foreach($criteria->getGroupByColumns() as $column) 
     492                foreach($criteria->getGroupByColumns() as $column) 
    700493        { 
    701494            $criteria->addSelectColumn($column); 
     
    708501            return $rs->getInt(1); 
    709502        } else { 
    710             // no rows returned; we infer that means 0 matches. 
    711             return 0; 
    712         } 
    713     } 
    714  
    715  
    716     /** 
    717      * Selects a collection of Interest objects pre-filled with all related objects except Question. 
    718      * 
    719      * @return array Array of Interest objects. 
    720      * @throws PropelException Any exceptions caught during processing will be 
    721      *       rethrown wrapped into a PropelException. 
    722      */ 
     503                        return 0; 
     504        } 
     505    } 
     506 
     507 
     508     
    723509    public static function doSelectJoinAllExceptQuestion(Criteria $c, $con = null) 
    724510    { 
    725511        $c = clone $c; 
    726512 
    727         // Set the correct dbName if it has not been overridden 
    728         // $c->getDbName() will return the same object if not set to another value 
    729         // so == check is okay and faster 
    730         if ($c->getDbName() == Propel::getDefaultDB()) { 
     513                                if ($c->getDbName() == Propel::getDefaultDB()) { 
    731514            $c->setDbName(self::DATABASE_NAME); 
    732515        } 
     
    762545            for ($j=0, $resCount=count($results); $j < $resCount; $j++) { 
    763546                $temp_obj1 = $results[$j]; 
    764                 $temp_obj2 = $temp_obj1->getUser(); //CHECKME 
    765                 if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { 
     547                $temp_obj2 = $temp_obj1->getUser();                 if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { 
    766548                    $newObject = false; 
    767549                    $temp_obj2->addInterest($obj1); 
     
    781563 
    782564 
    783     /** 
    784      * Selects a collection of Interest objects pre-filled with all related objects except User. 
    785      * 
    786      * @return array Array of Interest objects. 
    787      * @throws PropelException Any exceptions caught during processing will be 
    788      *       rethrown wrapped into a PropelException. 
    789      */ 
     565     
    790566    public static function doSelectJoinAllExceptUser(Criteria $c, $con = null) 
    791567    { 
    792568        $c = clone $c; 
    793569 
    794         // Set the correct dbName if it has not been overridden 
    795         // $c->getDbName() will return the same object if not set to another value 
    796         // so == check is okay and faster 
    797         if ($c->getDbName() == Propel::getDefaultDB()) { 
     570                                if ($c->getDbName() == Propel::getDefaultDB()) { 
    798571            $c->setDbName(self::DATABASE_NAME); 
    799572        } 
     
    829602            for ($j=0, $resCount=count($results); $j < $resCount; $j++) { 
    830603                $temp_obj1 = $results[$j]; 
    831                 $temp_obj2 = $temp_obj1->getQuestion(); //CHECKME 
    832                 if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { 
     604                $temp_obj2 = $temp_obj1->getQuestion();                 if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { 
    833605                    $newObject = false; 
    834606                    $temp_obj2->addInterest($obj1); 
     
    847619    } 
    848620 
    849     /** 
    850      * Returns the TableMap related to this peer. 
    851      * This method is not needed for general use but a specific application could have a need. 
    852      * @return TableMap 
    853      * @throws PropelException Any exceptions caught during processing will be 
    854      *       rethrown wrapped into a PropelException. 
    855      */ 
     621     
    856622    public static function getTableMap() 
    857623    { 
     
    859625    } 
    860626 
    861     /** 
    862      * The class that the Peer will make instances of. 
    863      * 
    864      * This uses a dot-path notation which is tranalted into a path 
    865      * relative to a location on the PHP include_path. 
    866      * (e.g. path.to.MyClass -> 'path/to/MyClass.php') 
    867      * 
    868      * @return string path.to.ClassName 
    869      */ 
     627     
    870628    public static function getOMClass() 
    871629    { 
     
    873631    } 
    874632 
    875     /** 
    876      * Method perform an INSERT on the database, given a Interest or Criteria object. 
    877      * 
    878      * @param mixed $values Criteria or Interest object containing data that is used to create the INSERT statement. 
    879      * @param Connection $con the connection to use 
    880      * @return mixed The new primary key. 
    881      * @throws PropelException Any exceptions caught during processing will be 
    882      *       rethrown wrapped into a PropelException. 
    883      */ 
     633     
    884634    public static function doInsert($values, $con = null) 
    885635    { 
     
    889639 
    890640        if ($values instanceof Criteria) { 
    891             $criteria = clone $values; // rename for clarity 
    892         } else { 
    893             $criteria = $values->buildCriteria(); // build Criteria from Interest object 
    894         } 
    895  
    896  
    897         // Set the correct dbName 
    898         $criteria->setDbName(self::DATABASE_NAME); 
     641            $criteria = clone $values;      } else { 
     642            $criteria = $values->buildCriteria();       } 
     643 
     644 
     645                $criteria->setDbName(self::DATABASE_NAME); 
    899646 
    900647        try { 
    901             // use transaction because $criteria could contain info 
    902             // for more than one table (I guess, conceivably) 
    903             $con->begin(); 
     648                                    $con->begin(); 
    904649            $pk = BasePeer::doInsert($criteria, $con); 
    905650            $con->commit(); 
     
    912657    } 
    913658 
    914     /** 
    915      * Method perform an UPDATE on the database, given a Interest or Criteria object. 
    916      * 
    917      * @param mixed $values Criteria or Interest object containing data that is used to create the UPDATE statement. 
    918      * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). 
    919      * @return int The number of affected rows (if supported by underlying database driver). 
    920      * @throws PropelException Any exceptions caught during processing will be 
    921      *       rethrown wrapped into a PropelException. 
    922      */ 
     659     
    923660    public static function doUpdate($values, $con = null) 
    924661    { 
     
    930667 
    931668        if ($values instanceof Criteria) { 
    932             $criteria = clone $values; // rename for clarity 
    933  
     669            $criteria = clone $values;  
    934670            $comparison = $criteria->getComparison(InterestPeer::QUESTION_ID); 
    935671            $selectCriteria->add(InterestPeer::QUESTION_ID, $criteria->remove(InterestPeer::QUESTION_ID), $comparison); 
     
    938674            $selectCriteria->add(InterestPeer::USER_ID, $criteria->remove(InterestPeer::USER_ID), $comparison); 
    939675 
    940         } else { // $values is Interest object 
    941             $criteria = $values->buildCriteria(); // gets full criteria 
    942             $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) 
    943         } 
    944  
    945         // set the correct dbName 
    946         $criteria->setDbName(self::DATABASE_NAME); 
     676        } else {            $criteria = $values->buildCriteria();           $selectCriteria = $values->buildPkeyCriteria();         } 
     677 
     678                $criteria->setDbName(self::DATABASE_NAME); 
    947679 
    948680        return BasePeer::doUpdate($selectCriteria, $criteria, $con); 
    949681    } 
    950682 
    951     /** 
    952      * Method to DELETE all rows from the ask_interest table. 
    953      * 
    954      * @return int The number of affected rows (if supported by underlying database driver). 
    955      */ 
     683     
    956684    public static function doDeleteAll($con = null) 
    957685    { 
     
    959687            $con = Propel::getConnection(self::DATABASE_NAME); 
    960688        } 
    961         $affectedRows = 0; // initialize var to track total num of affected rows 
    962         try { 
    963             // use transaction because $criteria could contain info 
    964             // for more than one table or we could emulating ON DELETE CASCADE, etc. 
    965             $con->begin(); 
     689        $affectedRows = 0;      try { 
     690                                    $con->begin(); 
    966691            $affectedRows += BasePeer::doDeleteAll(InterestPeer::TABLE_NAME, $con); 
    967692            $con->commit(); 
     
    973698    } 
    974699 
    975     /** 
    976      * Method perform a DELETE on the database, given a Interest or Criteria object OR a primary key value. 
    977      * 
    978      * @param mixed $values Criteria or Interest object or primary key or array of primary keys 
    979      *              which is used to create the DELETE statement 
    980      * @param Connection $con the connection to use 
    981      * @return int  The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows 
    982      *              if supported by native driver or if emulated using Propel. 
    983      * @throws PropelException Any exceptions caught during processing will be 
    984      *       rethrown wrapped into a PropelException. 
    985      */ 
     700     
    986701     public static function doDelete($values, $con = null) 
    987702     { 
     
    991706 
    992707        if ($values instanceof Criteria) { 
    993             $criteria = clone $values; // rename for clarity 
    994         } elseif ($values instanceof Interest) { 
     708            $criteria = clone $values;      } elseif ($values instanceof Interest) { 
    995709 
    996710            $criteria = $values->buildPkeyCriteria(); 
    997711        } else { 
    998             // it must be the primary key 
    999             $criteria = new Criteria(self::DATABASE_NAME); 
    1000             // primary key is composite; we therefore, expect 
    1001             // the primary key passed to be an array of pkey 
    1002             // values 
    1003             if(count($values) == count($values, COUNT_RECURSIVE)) 
     712                        $criteria = new Criteria(self::DATABASE_NAME); 
     713                                                if(count($values) == count($values, COUNT_RECURSIVE)) 
    1004714            { 
    1005                 // array is not multi-dimensional 
    1006                 $values = array($values); 
     715                                $values = array($values); 
    1007716            } 
    1008717            $vals = array(); 
     
    1018727        } 
    1019728 
    1020         // Set the correct dbName 
    1021         $criteria->setDbName(self::DATABASE_NAME); 
    1022  
    1023         $affectedRows = 0; // initialize var to track total num of affected rows 
    1024  
     729                $criteria->setDbName(self::DATABASE_NAME); 
     730 
     731        $affectedRows = 0;  
    1025732        try { 
    1026             // use transaction because $criteria could contain info 
    1027             // for more than one table or we could emulating ON DELETE CASCADE, etc. 
    1028             $con->begin(); 
     733                                    $con->begin(); 
    1029734             
    1030735            $affectedRows += BasePeer::doDelete($criteria, $con); 
     
    1037742    } 
    1038743 
    1039     /** 
    1040      * Validates all modified columns of given Interest object. 
    1041      * If parameter $columns is either a single column name or an array of column names 
    1042      * than only those columns are validated. 
    1043      * 
    1044      * NOTICE: This does not apply to primary or foreign keys for now. 
    1045      * 
    1046      * @param Interest $obj The object to validate. 
    1047      * @param mixed $cols Column name or array of column names. 
    1048      * 
    1049      * @return mixed TRUE if all columns are valid or the error message of the first invalid column. 
    1050      */ 
     744     
    1051745    public static function doValidate(Interest $obj, $cols = null) 
    1052746    { 
     
    1083777    } 
    1084778 
    1085     /** 
    1086      * Retrieve object using using composite pkey values. 
    1087      * @param int $question_id 
    1088        @param int $user_id 
    1089         
    1090      * @param Connection $con 
    1091      * @return Interest 
    1092      */ 
     779     
    1093780    public static function retrieveByPK( $question_id, $user_id, $con = null) { 
    1094781        if ($con === null) { 
     
    1099786        $criteria->add(InterestPeer::USER_ID, $user_id); 
    1100787        $v = InterestPeer::doSelect($criteria, $con); 
    1101         return !empty($v) ? $v[0] : null; 
    1102     } 
    1103 } // BaseInterestPeer 
    1104  
    1105 // static code to register the map builder for this Peer with the main Propel class 
     788 
     789        return !empty($v) ? $v[0] : null; 
     790    } 
     791}  
    1106792if (Propel::isInit()) { 
    1107     // the MapBuilder classes register themselves with Propel during initialization 
    1108     // so we need to load them here. 
    1109     try { 
     793            try { 
    1110794        BaseInterestPeer::getMapBuilder(); 
    1111795    } catch (Exception $e) { 
     
    1113797    } 
    1114798} else { 
    1115     // even if Propel is not yet initialized, the map builder class can be registered 
    1116     // now and then it will be loaded when Propel initializes. 
    1117     require_once 'model/map/InterestMapBuilder.php'; 
    1118     Propel::registerMapBuilder('model.map.InterestMapBuilder'); 
     799            require_once 'lib/model/map/InterestMapBuilder.php'; 
     800    Propel::registerMapBuilder('lib.model.map.InterestMapBuilder'); 
    1119801} 
  • trunk/lib/model/om/BaseQuestion.php

    r74 r88  
    11<?php 
    22 
    3 require_once 'propel/om/BaseObject.php'; 
    4  
    5 require_once 'propel/om/Persistent.php'; 
    6  
    7  
    8 include_once 'propel/util/Criteria.php'; 
    9  
    10 include_once 'model/QuestionPeer.php'; 
    11  
    12 /** 
    13  * Base class that represents a row from the 'ask_question' table. 
    14  * 
    15  *  
    16  * 
    17  * @package model.om 
    18  */ 
     3 
    194abstract class BaseQuestion extends BaseObject  implements Persistent { 
    205 
    216 
    22     /** 
    23      * The Peer class. 
    24      * Instance provides a convenient way of calling static methods on a class 
    25      * that calling code may not be able to identify. 
    26      * @var QuestionPeer 
    27      */ 
     7     
     8    const DATABASE_NAME = 'symfony'; 
     9 
     10     
    2811    protected static $peer; 
    2912 
    3013 
    31     /** 
    32      * The value for the id field. 
    33      * @var int 
    34      */ 
     14     
    3515    protected $id; 
    3616 
    3717 
    38     /** 
    39      * The value for the user_id field. 
    40      * @var int 
    41      */ 
     18     
    4219    protected $user_id; 
    4320 
    4421 
    45     /** 
    46      * The value for the title field. 
    47      * @var string 
    48      */ 
     22     
    4923    protected $title; 
    5024 
    5125 
    52     /** 
    53      * The value for the stripped_title field. 
    54      * @var string 
    55      */ 
     26     
    5627    protected $stripped_title; 
    5728 
    5829 
    59     /** 
    60      * The value for the body field. 
    61      * @var string 
    62      */ 
     30     
    6331    protected $body; 
    6432 
    6533 
    66     /** 
    67      * The value for the html_body field. 
    68      * @var string 
    69      */ 
     34     
    7035    protected $html_body; 
    7136 
    7237 
    73     /** 
    74      * The value for the interested_users field. 
    75      * @var int 
    76      */ 
     38     
    7739    protected $interested_users = 0; 
    7840 
    7941 
    80     /** 
    81      * The value for the reports field. 
    82      * @var int 
    83      */ 
     42     
    8443    protected $reports = 0; 
    8544 
    8645 
    87     /** 
    88      * The value for the created_at field. 
    89      * @var int 
    90      */ 
     46     
    9147    protected $created_at; 
    9248 
    9349 
    94     /** 
    95      * The value for the updated_at field. 
    96      * @var int 
    97      */ 
     50     
    9851    protected $updated_at; 
    9952 
    100     /** 
    101      * @var User 
    102      */ 
     53     
    10354    protected $aUser; 
    10455 
    105     /** 
    106      * Collection to store aggregation of collAnswers. 
    107      * @var array 
    108      */ 
     56     
    10957    protected $collAnswers; 
    110      
    111     /** 
    112      * The criteria used to select the current contents of collAnswers. 
    113      * @var Criteria 
    114      */ 
    115     private $lastAnswerCriteria = null; 
    116  
    117     /** 
    118      * Collection to store aggregation of collInterests. 
    119      * @var array 
    120      */ 
     58 
     59     
     60    protected $lastAnswerCriteria = null; 
     61 
     62     
    12163    protected $collInterests; 
    122      
    123     /** 
    124      * The criteria used to select the current contents of collInterests. 
    125      * @var Criteria 
    126      */ 
    127     private $lastInterestCriteria = null; 
    128  
    129     /** 
    130      * Collection to store aggregation of collQuestionTags. 
    131      * @var array 
    132      */ 
     64 
     65     
     66    protected $lastInterestCriteria = null; 
     67 
     68     
    13369    protected $collQuestionTags; 
    134      
    135     /** 
    136      * The criteria used to select the current contents of collQuestionTags. 
    137      * @var Criteria 
    138      */ 
    139     private $lastQuestionTagCriteria = null; 
    140  
    141     /** 
    142      * Collection to store aggregation of collSearchIndexs. 
    143      * @var array 
    144      */ 
     70 
     71     
     72    protected $lastQuestionTagCriteria = null; 
     73 
     74     
    14575    protected $collSearchIndexs; 
    146      
    147     /** 
    148      * The criteria used to select the current contents of collSearchIndexs. 
    149      * @var Criteria 
    150      */ 
    151     private $lastSearchIndexCriteria = null; 
    152  
    153     /** 
    154      * Collection to store aggregation of collReportQuestions. 
    155      * @var array 
    156      */ 
     76 
     77     
     78    protected $lastSearchIndexCriteria = null; 
     79 
     80     
    15781    protected $collReportQuestions; 
    158      
    159     /** 
    160      * The criteria used to select the current contents of collReportQuestions. 
    161      * @var Criteria 
    162      */ 
    163     private $lastReportQuestionCriteria = null; 
    164  
    165     /** 
    166      * Flag to prevent endless save loop, if this object is referenced 
    167      * by another object which falls in this transaction. 
    168      * @var boolean 
    169      */ 
     82 
     83     
     84    protected $lastReportQuestionCriteria = null; 
     85 
     86     
    17087    protected $alreadyInSave = false; 
    17188 
    172     /** 
    173      * Flag to prevent endless validation loop, if this object is referenced 
    174      * by another object which falls in this transaction. 
    175      * @var boolean 
    176      */ 
     89     
    17790    protected $alreadyInValidation = false; 
    17891 
    179     /** 
    180      * Get the [id] column value. 
    181      *  
    182      * @return int 
    183      */ 
     92     
    18493    public function getId() 
    18594    { 
     
    18897    } 
    18998 
    190     /** 
    191      * Get the [user_id] column value. 
    192      *  
    193      * @return int 
    194      */ 
     99     
    195100    public function getUserId() 
    196101    { 
     
    199104    } 
    200105 
    201     /** 
    202      * Get the [title] column value. 
    203      *  
    204      * @return string 
    205      */ 
     106     
    206107    public function getTitle() 
    207108    { 
     
    210111    } 
    211112 
    212     /** 
    213      * Get the [stripped_title] column value. 
    214      *  
    215      * @return string 
    216      */ 
     113     
    217114    public function getStrippedTitle() 
    218115    { 
     
    221118    } 
    222119 
    223     /** 
    224      * Get the [body] column value. 
    225      *  
    226      * @return string 
    227      */ 
     120     
    228121    public function getBody() 
    229122    { 
     
    232125    } 
    233126 
    234     /** 
    235      * Get the [html_body] column value. 
    236      *  
    237      * @return string 
    238      */ 
     127     
    239128    public function getHtmlBody() 
    240129    { 
     
    243132    } 
    244133 
    245     /** 
    246      * Get the [interested_users] column value. 
    247      *  
    248      * @return int 
    249      */ 
     134     
    250135    public function getInterestedUsers() 
    251136    { 
     
    254139    } 
    255140 
    256     /** 
    257      * Get the [reports] column value. 
    258      *  
    259      * @return int 
    260      */ 
     141     
    261142    public function getReports() 
    262143    { 
     
    265146    } 
    266147 
    267     /** 
    268      * Get the [optionally formatted] [created_at] column value. 
    269      *  
    270      * @param string $format The date/time format string (either date()-style or strftime()-style). 
    271      *                          If format is NULL, then the integer unix timestamp will be returned. 
    272      * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). 
    273      * @throws PropelException - if unable to convert the date/time to timestamp. 
    274      */ 
     148     
    275149    public function getCreatedAt($format = 'Y-m-d H:i:s') 
    276150    { 
     
    279153            return null; 
    280154        } elseif (!is_int($this->created_at)) { 
    281             // a non-timestamp value was set externally, so we convert it 
    282             $ts = strtotime($this->created_at); 
    283             if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE 
    284                 throw new PropelException("Unable to parse value of [created_at] as date/time value: " . var_export($this->created_at, true)); 
     155                        $ts = strtotime($this->created_at); 
     156            if ($ts === -1 || $ts === false) {              throw new PropelException("Unable to parse value of [created_at] as date/time value: " . var_export($this->created_at, true)); 
    285157            } 
    286158        } else { 
     
    296168    } 
    297169 
    298     /** 
    299      * Get the [optionally formatted] [updated_at] column value. 
    300      *  
    301      * @param string $format The date/time format string (either date()-style or strftime()-style). 
    302      *                          If format is NULL, then the integer unix timestamp will be returned. 
    303      * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). 
    304      * @throws PropelException - if unable to convert the date/time to timestamp. 
    305      */ 
     170     
    306171    public function getUpdatedAt($format = 'Y-m-d H:i:s') 
    307172    { 
     
    310175            return null; 
    311176        } elseif (!is_int($this->updated_at)) { 
    312             // a non-timestamp value was set externally, so we convert it 
    313             $ts = strtotime($this->updated_at); 
    314             if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE 
    315                 throw new PropelException("Unable to parse value of [updated_at] as date/time value: " . var_export($this->updated_at, true)); 
     177                        $ts = strtotime($this->updated_at); 
     178            if ($ts === -1 || $ts === false) {              throw new PropelException("Unable to parse value of [updated_at] as date/time value: " . var_export($this->updated_at, true)); 
    316179            } 
    317180        } else { 
     
    327190    } 
    328191 
    329     /** 
    330      * Set the value of [id] column. 
    331      *  
    332      * @param int $v new value 
    333      * @return void 
    334      */ 
     192     
    335193    public function setId($v) 
    336194    { 
     
    341199        } 
    342200 
    343     } // setId() 
    344  
    345     /** 
    346      * Set the value of [user_id] column. 
    347      *  
    348      * @param int $v new value 
    349      * @return void 
    350      */ 
     201    }  
     202     
    351203    public function setUserId($v) 
    352204    { 
     
    359211        if ($this->aUser !== null && $this->aUser->getId() !== $v) { 
    360212            $this->aUser = null; 
    361         }        
    362  
    363     } // setUserId() 
    364  
    365     /** 
    366      * Set the value of [title] column. 
    367      *  
    368      * @param string $v new value 
    369      * @return void 
    370      */ 
     213        } 
     214 
     215    }  
     216     
    371217    public function setTitle($v) 
    372218    { 
     
    377223        } 
    378224 
    379     } // setTitle() 
    380  
    381     /** 
    382      * Set the value of [stripped_title] column. 
    383      *  
    384      * @param string $v new value 
    385      * @return void 
    386      */ 
     225    }  
     226     
    387227    public function setStrippedTitle($v) 
    388228    { 
     
    393233        } 
    394234 
    395     } // setStrippedTitle() 
    396  
    397     /** 
    398      * Set the value of [body] column. 
    399      *  
    400      * @param string $v new value 
    401      * @return void 
    402      */ 
     235    }  
     236     
    403237    public function setBody($v) 
    404238    { 
     
    409243        } 
    410244 
    411     } // setBody() 
    412  
    413     /** 
    414      * Set the value of [html_body] column. 
    415      *  
    416      * @param string $v new value 
    417      * @return void 
    418      */ 
     245    }  
     246     
    419247    public function setHtmlBody($v) 
    420248    { 
     
    425253        } 
    426254 
    427     } // setHtmlBody() 
    428  
    429     /** 
    430      * Set the value of [interested_users] column. 
    431      *  
    432      * @param int $v new value 
    433      * @return void 
    434      */ 
     255    }  
     256     
    435257    public function setInterestedUsers($v) 
    436258    { 
     
    441263        } 
    442264 
    443     } // setInterestedUsers() 
    444  
    445     /** 
    446      * Set the value of [reports] column. 
    447      *  
    448      * @param int $v new value 
    449      * @return void 
    450      */ 
     265    }  
     266     
    451267    public function setReports($v) 
    452268    { 
     
    457273        } 
    458274 
    459     } // setReports() 
    460  
    461     /** 
    462      * Set the value of [created_at] column. 
    463      *  
    464      * @param int $v new value 
    465      * @return void 
    466      */ 
     275    }  
     276     
    467277    public function setCreatedAt($v) 
    468278    { 
     
    470280        if ($v !== null && !is_int($v)) { 
    471281            $ts = strtotime($v); 
    472             if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE 
    473                 throw new PropelException("Unable to parse date/time value for [created_at] from input: " . var_export($v, true)); 
     282            if ($ts === -1 || $ts === false) {              throw new PropelException("Unable to parse date/time value for [created_at] from input: " . var_export($v, true)); 
    474283            } 
    475284        } else { 
     
    481290        } 
    482291 
    483     } // setCreatedAt() 
    484  
    485     /** 
    486      * Set the value of [updated_at] column. 
    487      *  
    488      * @param int $v new value 
    489      * @return void 
    490      */ 
     292    }  
     293     
    491294    public function setUpdatedAt($v) 
    492295    { 
     
    494297        if ($v !== null && !is_int($v)) { 
    495298            $ts = strtotime($v); 
    496             if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE 
    497                 throw new PropelException("Unable to parse date/time value for [updated_at] from input: " . var_export($v, true)); 
     299            if ($ts === -1 || $ts === false) {              throw new PropelException("Unable to parse date/time value for [updated_at] from input: " . var_export($v, true)); 
    498300            } 
    499301        } else { 
     
    505307        } 
    506308 
    507     } // setUpdatedAt() 
    508  
    509     /** 
    510      * Hydrates (populates) the object variables with values from the database resultset. 
    511      * 
    512      * An offset (1-based "start column") is specified so that objects can be hydrated 
    513      * with a subset of the columns in the resultset rows.  This is needed, for example, 
    514      * for results of JOIN queries where the resultset row includes columns from two or 
    515      * more tables. 
    516      * 
    517      * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. 
    518      * @param int $startcol 1-based offset column which indicates which restultset column to start with. 
    519      * @return int next starting column 
    520      * @throws PropelException  - Any caught Exception will be rewrapped as a PropelException. 
    521      */ 
     309    }  
     310     
    522311    public function hydrate(ResultSet $rs, $startcol = 1) 
    523312    { 
     
    548337            $this->setNew(false); 
    549338 
    550             // FIXME - using NUM_COLUMNS may be clearer. 
    551             return $startcol + 10; // 10 = QuestionPeer::NUM_COLUMNS - QuestionPeer::NUM_LAZY_LOAD_COLUMNS). 
    552  
     339                        return $startcol + 10;  
    553340        } catch (Exception $e) { 
    554341            throw new PropelException("Error populating Question object", $e); 
     
    556343    } 
    557344 
    558     /** 
    559      * Removes this object from datastore and sets delete attribute. 
    560      * 
    561      * @param Connection $con 
    562      * @return void 
    563      * @throws PropelException 
    564      * @see BaseObject::setDeleted() 
    565      * @see BaseObject::isDeleted() 
    566      */ 
     345     
    567346    public function delete($con = null) 
    568347    { 
     
    586365    } 
    587366 
    588     /** 
    589      * Stores the object in the database.  If the object is new, 
    590      * it inserts it; otherwise an update is performed.  This method 
    591      * wraps the doSave() worker method in a transaction. 
    592      * 
    593      * @param Connection $con 
    594      * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. 
    595      * @throws PropelException 
    596      * @see doSave() 
    597      */ 
     367     
    598368    public function save($con = null) 
    599369    { 
    600     if ($this->isNew()
     370    if ($this->isNew() && !$this->isColumnModified(QuestionPeer::CREATED_AT)
    601371    { 
    602372      $this->setCreatedAt(time()); 
    603373    } 
    604         $this->setUpdatedAt(time()); 
     374 
     375    if ($this->isModified() && !$this->isColumnModified(QuestionPeer::UPDATED_AT)) 
     376    { 
     377      $this->setUpdatedAt(time()); 
     378    } 
    605379 
    606380        if ($this->isDeleted()) { 
     
    611385            $con = Propel::getConnection(QuestionPeer::DATABASE_NAME); 
    612386        } 
    613          
     387 
    614388        try { 
    615389            $con->begin(); 
     
    623397    } 
    624398 
    625     /** 
    626      * Stores the object in the database. 
    627      *  
    628      * If the object is new, it inserts it; otherwise an update is performed. 
    629      * All related objects are also updated in this method. 
    630      * 
    631      * @param Connection $con 
    632      * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. 
    633      * @throws PropelException 
    634      * @see save() 
    635      */ 
     399     
    636400    protected function doSave($con) 
    637401    { 
    638         $affectedRows = 0; // initialize var to track total num of affected rows     
    639         if (!$this->alreadyInSave) { 
     402        $affectedRows = 0;      if (!$this->alreadyInSave) { 
    640403            $this->alreadyInSave = true; 
    641404 
    642405 
    643             // We call the save method on the following object(s) if they 
    644             // were passed to this object by their coresponding set 
    645             // method.  This object relates to these object(s) by a 
    646             // foreign key reference. 
    647  
     406                                                 
    648407            if ($this->aUser !== null) { 
    649408                if ($this->aUser->isModified()) { 
     
    652411                $this->setUser($this->aUser); 
    653412            } 
    654      
    655  
    656             // If this object has been modified, then save it to the database. 
    657             if ($this->isModified()) { 
     413 
     414 
     415                        if ($this->isModified()) { 
    658416                if ($this->isNew()) { 
    659417                    $pk = QuestionPeer::doInsert($this, $con); 
    660                     $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which  
    661                                          // should always be true here (even though technically  
    662                                          // BasePeer::doInsert() can insert multiple rows). 
    663  
    664                     $this->setId($pk);  //[IMV] update autoincrement primary key 
    665  
     418                    $affectedRows += 1;                                                                                   
     419                    $this->setId($pk);   
    666420                    $this->setNew(false); 
    667421                } else { 
    668422                    $affectedRows += QuestionPeer::doUpdate($this, $con); 
    669423                } 
    670                 $this->resetModified(); // [HL] After being saved an object is no longer 'modified' 
    671             } 
     424                $this->resetModified();             } 
    672425 
    673426            if ($this->collAnswers !== null) { 
     
    714467        } 
    715468        return $affectedRows; 
    716     } // doSave() 
    717  
    718     /** 
    719      * Array of ValidationFailed objects. 
    720      * @var array ValidationFailed[] 
    721      */ 
     469    }  
     470     
    722471    protected $validationFailures = array(); 
    723472 
    724     /** 
    725      * Gets any ValidationFailed objects that resulted from last call to validate(). 
    726      * 
    727      * 
    728      * @return array ValidationFailed[] 
    729      * @see validate() 
    730      */ 
     473     
    731474    public function getValidationFailures() 
    732475    { 
     
    734477    } 
    735478 
    736     /** 
    737      * Validates the objects modified field values and all objects related to this table. 
    738      * 
    739      * If $columns is either a column name or an array of column names 
    740      * only those columns are validated. 
    741      * 
    742      * @param mixed $columns Column name or an array of column names. 
    743      * @return boolean Whether all columns pass validation. 
    744      * @see doValidate() 
    745      * @see getValidationFailures() 
    746      */ 
     479     
    747480    public function validate($columns = null) 
    748481    { 
     
    757490    } 
    758491 
    759     /** 
    760      * This function performs the validation work for complex object models. 
    761      * 
    762      * In addition to checking the current object, all related objects will 
    763      * also be validated.  If all pass then <code>true</code> is returned; otherwise 
    764      * an aggreagated array of ValidationFailed objects will be returned. 
    765      * 
    766      * @param array $columns Array of column names to validate. 
    767      * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. 
    768      */ 
     492     
    769493    protected function doValidate($columns = null) 
    770494    { 
     
    776500 
    777501 
    778             // We call the validate method on the following object(s) if they 
    779             // were passed to this object by their coresponding set 
    780             // method.  This object relates to these object(s) by a 
    781             // foreign key reference. 
    782  
     502                                                 
    783503            if ($this->aUser !== null) { 
    784504                if (!$this->aUser->validate($columns)) { 
     
    840560    } 
    841561 
    842     /** 
    843      * Retrieves a field from the object by name passed in as a string. 
    844      * 
    845      * @param string $name name 
    846      * @param string $type The type of fieldname the $name is of: 
    847      *                     one of the class type constants TYPE_PHPNAME, 
    848      *                     TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM 
    849      * @return mixed Value of field. 
    850      */ 
     562     
    851563    public function getByName($name, $type = BasePeer::TYPE_PHPNAME) 
    852564    { 
     
    855567    } 
    856568 
    857     /** 
    858      * Retrieves a field from the object by Position as specified in the xml schema. 
    859      * Zero-based. 
    860      * 
    861      * @param int $pos position in xml schema 
    862      * @return mixed Value of field at $pos 
    863      */ 
     569     
    864570    public function getByPosition($pos) 
    865571    { 
     
    898604                return null; 
    899605                break; 
    900         } // switch() 
    901     } 
    902  
    903     /** 
    904      * Exports the object as an array. 
    905      * 
    906      * You can specify the key type of the array by passing one of the class 
    907      * type constants. 
    908      * 
    909      * @param string $keyType One of the class type constants TYPE_PHPNAME, 
    910      *                        TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM 
    911      * @return an associative array containing the field names (as keys) and field values 
    912      */ 
     606        }   } 
     607 
     608     
    913609    public function toArray($keyType = BasePeer::TYPE_PHPNAME) 
    914610    { 
     
    929625    } 
    930626 
    931     /** 
    932      * Sets a field from the object by name passed in as a string. 
    933      * 
    934      * @param string $name peer name 
    935      * @param mixed $value field value 
    936      * @param string $type The type of fieldname the $name is of: 
    937      *                     one of the class type constants TYPE_PHPNAME, 
    938      *                     TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM 
    939      * @return void 
    940      */ 
     627     
    941628    public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) 
    942629    { 
     
    945632    } 
    946633 
    947     /** 
    948      * Sets a field from the object by Position as specified in the xml schema. 
    949      * Zero-based. 
    950      * 
    951      * @param int $pos position in xml schema 
    952      * @param mixed $value field value 
    953      * @return void 
    954      */ 
     634     
    955635    public function setByPosition($pos, $value) 
    956636    { 
     
    986666                $this->setUpdatedAt($value); 
    987667                break; 
    988         } // switch() 
    989     } 
    990  
    991     /** 
    992      * Populates the object using an array. 
    993      * 
    994      * This is particularly useful when populating an object from one of the 
    995      * request arrays (e.g. $_POST).  This method goes through the column 
    996      * names, checking to see whether a matching key exists in populated 
    997      * array. If so the setByName() method is called for that column. 
    998      * 
    999      * You can specify the key type of the array by additionally passing one 
    1000      * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, 
    1001      * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') 
    1002      * 
    1003      * @param array  $arr     An array to populate the object from. 
    1004      * @param string $keyType The type of keys the array uses. 
    1005      * @return void 
    1006      */ 
     668        }   } 
     669 
     670     
    1007671    public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) 
    1008672    { 
     
    1021685    } 
    1022686 
    1023     /** 
    1024      * Build a Criteria object containing the values of all modified columns in this object. 
    1025      * 
    1026      * @return Criteria The Criteria object containing all modified values. 
    1027      */ 
     687     
    1028688    public function buildCriteria() 
    1029689    { 
     
    1044704    } 
    1045705 
    1046     /** 
    1047      * Builds a Criteria object containing the primary key for this object. 
    1048      * 
    1049      * Unlike buildCriteria() this method includes the primary key values regardless 
    1050      * of whether or not they have been modified. 
    1051      * 
    1052      * @return Criteria The Criteria object containing value(s) for primary key(s). 
    1053      */ 
     706     
    1054707    public function buildPkeyCriteria() 
    1055708    { 
     
    1061714    } 
    1062715 
    1063     /** 
    1064      * Returns the primary key for this object (row). 
    1065      * @return int 
    1066      */ 
     716     
    1067717    public function getPrimaryKey() 
    1068718    { 
     
    1070720    } 
    1071721 
    1072     /** 
    1073      * Generic method to set the primary key (id column). 
    1074      * 
    1075      * @param int $key Primary key. 
    1076      * @return void 
    1077      */ 
     722     
    1078723    public function setPrimaryKey($key) 
    1079724    { 
     
    1081726    } 
    1082727 
    1083     /** 
    1084      * Sets contents of passed object to values from current object. 
    1085      *  
    1086      * If desired, this method can also make copies of all associated (fkey referrers) 
    1087      * objects. 
    1088      * 
    1089      * @param object $copyObj An object of Question (or compatible) type. 
    1090      * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. 
    1091      * @throws PropelException 
    1092      */ 
     728     
    1093729    public function copyInto($copyObj, $deepCopy = false) 
    1094730    { 
     
    1114750 
    1115751        if ($deepCopy) { 
    1116             // important: temporarily setNew(false) because this affects the behavior of 
    1117             // the getter/setter methods for fkey referrer objects. 
    1118             $copyObj->setNew(false); 
     752                                    $copyObj->setNew(false); 
    1119753 
    1120754            foreach($this->getAnswers() as $relObj) { 
    1121                 if($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves 
    1122                     $copyObj->addAnswer($relObj->copy($deepCopy)); 
    1123                 } 
     755                $copyObj->addAnswer($relObj->copy($deepCopy)); 
    1124756            } 
    1125757 
    1126758            foreach($this->getInterests() as $relObj) { 
    1127                 if($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves 
    1128                     $copyObj->addInterest($relObj->copy($deepCopy)); 
    1129                 } 
     759                $copyObj->addInterest($relObj->copy($deepCopy)); 
    1130760            } 
    1131761 
    1132762            foreach($this->getQuestionTags() as $relObj) { 
    1133                 if($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves 
    1134                     $copyObj->addQuestionTag($relObj->copy($deepCopy)); 
    1135                 } 
     763                $copyObj->addQuestionTag($relObj->copy($deepCopy)); 
    1136764            } 
    1137765 
    1138766            foreach($this->getSearchIndexs() as $relObj) { 
    1139                 if($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves 
    1140                     $copyObj->addSearchIndex($relObj->copy($deepCopy)); 
    1141                 } 
     767                $copyObj->addSearchIndex($relObj->copy($deepCopy)); 
    1142768            } 
    1143769 
    1144770            foreach($this->getReportQuestions() as $relObj) { 
    1145                 if($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves 
    1146                     $copyObj->addReportQuestion($relObj->copy($deepCopy)); 
    1147                 } 
    1148             } 
    1149  
    1150         } // if ($deepCopy) 
    1151  
     771                $copyObj->addReportQuestion($relObj->copy($deepCopy)); 
     772            } 
     773 
     774        }  
    1152775 
    1153776        $copyObj->setNew(true); 
    1154777 
    1155         $copyObj->setId(NULL); // this is a pkey column, so set to default value 
    1156  
    1157     } 
    1158  
    1159     /** 
    1160      * Makes a copy of this object that will be inserted as a new row in table when saved. 
    1161      * It creates a new object filling in the simple attributes, but skipping any primary 
    1162      * keys that are defined for the table. 
    1163      *  
    1164      * If desired, this method can also make copies of all associated (fkey referrers) 
    1165      * objects. 
    1166      * 
    1167      * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. 
    1168      * @return Question Clone of current object. 
    1169      * @throws PropelException 
    1170      */ 
     778        $copyObj->setId(NULL);  
     779    } 
     780 
     781     
    1171782    public function copy($deepCopy = false) 
    1172783    { 
    1173         // we use get_class(), because this might be a subclass 
    1174         $clazz = get_class($this); 
     784                $clazz = get_class($this); 
    1175785        $copyObj = new $clazz(); 
    1176786        $this->copyInto($copyObj, $deepCopy); 
     
    1178788    } 
    1179789 
    1180     /** 
    1181      * Returns a peer instance associated with this om. 
    1182      * 
    1183      * Since Peer classes are not to have any instance attributes, this method returns the 
    1184      * same instance for all member of this class. The method could therefore 
    1185      * be static, but this would prevent one from overriding the behavior. 
    1186      * 
    1187      * @return QuestionPeer 
    1188      */ 
     790     
    1189791    public function getPeer() 
    1190792    { 
     
    1195797    } 
    1196798 
    1197     /** 
    1198      * Declares an association between this object and a User object. 
    1199      * 
    1200      * @param User $v 
    1201      * @return void 
    1202      * @throws PropelException 
    1203      */ 
     799     
    1204800    public function setUser($v) 
    1205801    { 
     
    1217813 
    1218814 
    1219     /** 
    1220      * Get the associated User object 
    1221      * 
    1222      * @param Connection Optional Connection object. 
    1223      * @return User The associated User object. 
    1224      * @throws PropelException 
    1225      */ 
     815     
    1226816    public function getUser($con = null) 
    1227817    { 
    1228         // include the related Peer class 
    1229         include_once 'model/om/BaseUserPeer.php'; 
     818                include_once 'lib/model/om/BaseUserPeer.php'; 
    1230819 
    1231820        if ($this->aUser === null && ($this->user_id !== null)) { 
    1232821 
    1233822            $this->aUser = UserPeer::retrieveByPK($this->user_id, $con); 
    1234                      
    1235             /* The following can be used instead of the line above to 
    1236                guarantee the related object contains a reference 
    1237                to this object, but this level of coupling 
    1238                may be undesirable in many circumstances. 
    1239                As it can lead to a db query with many results that may 
    1240                never be used. 
    1241                $obj = UserPeer::retrieveByPK($this->user_id, $con); 
    1242                $obj->addUsers($this); 
    1243              */ 
     823 
     824             
    1244825        } 
    1245826        return $this->aUser; 
    1246827    } 
    1247828 
    1248     /** 
    1249      * Temporary storage of collAnswers to save a possible db hit in 
    1250      * the event objects are add to the collection, but the 
    1251      * complete collection is never requested. 
    1252      * @return void 
    1253      */ 
     829     
    1254830    public function initAnswers() 
    1255831    { 
     
    1259835    } 
    1260836 
    1261     /** 
    1262      * If this collection has already been initialized with 
    1263      * an identical criteria, it returns the collection. 
    1264      * Otherwise if this Question has previously 
    1265      * been saved, it will retrieve related Answers from storage. 
    1266      * If this Question is new, it will return 
    1267      * an empty collection or the current collection, the criteria 
    1268      * is ignored on a new object. 
    1269      * 
    1270      * @param Connection $con 
    1271      * @param Criteria $criteria 
    1272      * @throws PropelException 
    1273      */ 
     837     
    1274838    public function getAnswers($criteria = null, $con = null) 
    1275839    { 
    1276         // include the Peer class 
    1277         include_once 'model/om/BaseAnswerPeer.php'; 
     840                include_once 'lib/model/om/BaseAnswerPeer.php'; 
    1278841        if ($criteria === null) { 
    1279842            $criteria = new Criteria(); 
     
    1295858            } 
    1296859        } else { 
    1297             // criteria has no effect for a new object 
    1298             if (!$this->isNew()) { 
    1299                 // the following code is to determine if a new query is 
    1300                 // called for.  If the criteria is the same as the last 
    1301                 // one, just return the collection. 
    1302  
     860                        if (!$this->isNew()) { 
     861                                                 
    1303862 
    1304863                $criteria->add(AnswerPeer::QUESTION_ID, $this->getId()); 
     
    1314873    } 
    1315874 
    1316     /** 
    1317      * Returns the number of related Answers. 
    1318      * 
    1319      * @param Criteria $criteria 
    1320      * @param boolean $distinct 
    1321      * @param Connection $con 
    1322      * @throws PropelException 
    1323      */ 
     875     
    1324876    public function countAnswers($criteria = null, $distinct = false, $con = null) 
    1325877    { 
    1326         // include the Peer class 
    1327         include_once 'model/om/BaseAnswerPeer.php'; 
     878                include_once 'lib/model/om/BaseAnswerPeer.php'; 
    1328879        if ($criteria === null) { 
    1329880            $criteria = new Criteria(); 
     
    1339890    } 
    1340891 
    1341     /** 
    1342      * Method called to associate a Answer object to this object 
    1343      * through the Answer foreign key attribute 
    1344      * 
    1345      * @param Answer $l Answer 
    1346      * @return void 
    1347      * @throws PropelException 
    1348      */ 
     892     
    1349893    public function addAnswer(Answer $l) 
    1350894    { 
     
    1354898 
    1355899 
    1356     /** 
    1357      * If this collection has already been initialized with 
    1358      * an identical criteria, it returns the collection. 
    1359      * Otherwise if this Question is new, it will return 
    1360      * an empty collection; or if this Question has previously 
    1361      * been saved, it will retrieve related Answers from storage. 
    1362      * 
    1363      * This method is protected by default in order to keep the public 
    1364      * api reasonable.  You can provide public methods for those you 
    1365      * actually need in Question. 
    1366      */ 
     900     
    1367901    public function getAnswersJoinUser($criteria = null, $con = null) 
    1368902    { 
    1369         // include the Peer class 
    1370         include_once 'model/om/BaseAnswerPeer.php'; 
     903                include_once 'lib/model/om/BaseAnswerPeer.php'; 
    1371904        if ($criteria === null) { 
    1372905            $criteria = new Criteria(); 
     
    1387920            } 
    1388921        } else { 
    1389             // the following code is to determine if a new query is 
    1390             // called for.  If the criteria is the same as the last 
    1391             // one, just return the collection. 
    1392  
     922                                     
    1393923            $criteria->add(AnswerPeer::QUESTION_ID, $this->getId()); 
    1394924 
     
    1402932    } 
    1403933 
    1404     /** 
    1405      * Temporary storage of collInterests to save a possible db hit in 
    1406      * the event objects are add to the collection, but the 
    1407      * complete collection is never requested. 
    1408      * @return void 
    1409      */ 
     934     
    1410935    public function initInterests() 
    1411936    { 
     
    1415940    } 
    1416941 
    1417     /** 
    1418      * If this collection has already been initialized with 
    1419      * an identical criteria, it returns the collection. 
    1420      * Otherwise if this Question has previously 
    1421      * been saved, it will retrieve related Interests from storage. 
    1422      * If this Question is new, it will return 
    1423      * an empty collection or the current collection, the criteria 
    1424      * is ignored on a new object. 
    1425      * 
    1426      * @param Connection $con 
    1427      * @param Criteria $criteria 
    1428      * @throws PropelException 
    1429      */ 
     942     
    1430943    public function getInterests($criteria = null, $con = null) 
    1431944    { 
    1432         // include the Peer class 
    1433         include_once 'model/om/BaseInterestPeer.php'; 
     945                include_once 'lib/model/om/BaseInterestPeer.php'; 
    1434946        if ($criteria === null) { 
    1435947            $criteria = new Criteria(); 
     
    1451963            } 
    1452964        } else { 
    1453             // criteria has no effect for a new object 
    1454             if (!$this->isNew()) { 
    1455                 // the following code is to determine if a new query is 
    1456                 // called for.  If the criteria is the same as the last 
    1457                 // one, just return the collection. 
    1458  
     965                        if (!$this->isNew()) { 
     966                                                 
    1459967 
    1460968                $criteria->add(InterestPeer::QUESTION_ID, $this->getId()); 
     
    1470978    } 
    1471979 
    1472     /** 
    1473      * Returns the number of related Interests. 
    1474      * 
    1475      * @param Criteria $criteria 
    1476      * @param boolean $distinct 
    1477      * @param Connection $con 
    1478      * @throws PropelException 
    1479      */ 
     980     
    1480981    public function countInterests($criteria = null, $distinct = false, $con = null) 
    1481982    { 
    1482         // include the Peer class 
    1483         include_once 'model/om/BaseInterestPeer.php'; 
     983                include_once 'lib/model/om/BaseInterestPeer.php'; 
    1484984        if ($criteria === null) { 
    1485985            $criteria = new Criteria(); 
     
    1495995    } 
    1496996 
    1497     /** 
    1498      * Method called to associate a Interest object to this object 
    1499      * through the Interest foreign key attribute 
    1500      * 
    1501      * @param Interest $l Interest 
    1502      * @return void 
    1503      * @throws PropelException 
    1504      */ 
     997     
    1505998    public function addInterest(Interest $l) 
    1506999    { 
     
    15101003 
    15111004 
    1512     /** 
    1513      * If this collection has already been initialized with 
    1514      * an identical criteria, it returns the collection. 
    1515      * Otherwise if this Question is new, it will return 
    1516      * an empty collection; or if this Question has previously 
    1517      * been saved, it will retrieve related Interests from storage. 
    1518      * 
    1519      * This method is protected by default in order to keep the public 
    1520      * api reasonable.  You can provide public methods for those you 
    1521      * actually need in Question. 
    1522      */ 
     1005     
    15231006    public function getInterestsJoinUser($criteria = null, $con = null) 
    15241007    { 
    1525         // include the Peer class 
    1526         include_once 'model/om/BaseInterestPeer.php'; 
     1008                include_once 'lib/model/om/BaseInterestPeer.php'; 
    15271009        if ($criteria === null) { 
    15281010            $criteria = new Criteria(); 
     
    15431025            } 
    15441026        } else { 
    1545             // the following code is to determine if a new query is 
    1546             // called for.  If the criteria is the same as the last 
    1547             // one, just return the collection. 
    1548  
     1027                                     
    15491028            $criteria->add(InterestPeer::QUESTION_ID, $this->getId()); 
    15501029 
     
    15581037    } 
    15591038 
    1560     /** 
    1561      * Temporary storage of collQuestionTags to save a possible db hit in 
    1562      * the event objects are add to the collection, but the 
    1563      * complete collection is never requested. 
    1564      * @return void 
    1565      */ 
     1039     
    15661040    public function initQuestionTags() 
    15671041    { 
     
    15711045    } 
    15721046 
    1573     /** 
    1574      * If this collection has already been initialized with 
    1575      * an identical criteria, it returns the collection. 
    1576      * Otherwise if this Question has previously 
    1577      * been saved, it will retrieve related QuestionTags from storage. 
    1578      * If this Question is new, it will return 
    1579      * an empty collection or the current collection, the criteria 
    1580      * is ignored on a new object. 
    1581      * 
    1582      * @param Connection $con 
    1583      * @param Criteria $criteria 
    1584      * @throws PropelException 
    1585      */ 
     1047     
    15861048    public function getQuestionTags($criteria = null, $con = null) 
    15871049    { 
    1588         // include the Peer class 
    1589         include_once 'model/om/BaseQuestionTagPeer.php'; 
     1050                include_once 'lib/model/om/BaseQuestionTagPeer.php'; 
    15901051        if ($criteria === null) { 
    15911052            $criteria = new Criteria(); 
     
    16071068            } 
    16081069        } else { 
    1609             // criteria has no effect for a new object 
    1610             if (!$this->isNew()) { 
    1611                 // the following code is to determine if a new query is 
    1612                 // called for.  If the criteria is the same as the last 
    1613                 // one, just return the collection. 
    1614  
     1070                        if (!$this->isNew()) { 
     1071                                                 
    16151072 
    16161073                $criteria->add(QuestionTagPeer::QUESTION_ID, $this->getId()); 
     
    16261083    } 
    16271084 
    1628     /** 
    1629      * Returns the number of related QuestionTags. 
    1630      * 
    1631      * @param Criteria $criteria 
    1632      * @param boolean $distinct 
    1633      * @param Connection $con 
    1634      * @throws PropelException 
    1635      */ 
     1085     
    16361086    public function countQuestionTags($criteria = null, $distinct = false, $con = null) 
    16371087    { 
    1638         // include the Peer class 
    1639         include_once 'model/om/BaseQuestionTagPeer.php'; 
     1088                include_once 'lib/model/om/BaseQuestionTagPeer.php'; 
    16401089        if ($criteria === null) { 
    16411090            $criteria = new Criteria(); 
     
    16511100    } 
    16521101 
    1653     /** 
    1654      * Method called to associate a QuestionTag object to this object 
    1655      * through the QuestionTag foreign key attribute 
    1656      * 
    1657      * @param QuestionTag $l QuestionTag 
    1658      * @return void 
    1659      * @throws PropelException 
    1660      */ 
     1102     
    16611103    public function addQuestionTag(QuestionTag $l) 
    16621104    { 
     
    16661108 
    16671109 
    1668     /** 
    1669      * If this collection has already been initialized with 
    1670      * an identical criteria, it returns the collection. 
    1671      * Otherwise if this Question is new, it will return 
    1672      * an empty collection; or if this Question has previously 
    1673      * been saved, it will retrieve related QuestionTags from storage. 
    1674      * 
    1675      * This method is protected by default in order to keep the public 
    1676      * api reasonable.  You can provide public methods for those you 
    1677      * actually need in Question. 
    1678      */ 
     1110     
    16791111    public function getQuestionTagsJoinUser($criteria = null, $con = null) 
    16801112    { 
    1681         // include the Peer class 
    1682         include_once 'model/om/BaseQuestionTagPeer.php'; 
     1113                include_once 'lib/model/om/BaseQuestionTagPeer.php'; 
    16831114        if ($criteria === null) { 
    16841115            $criteria = new Criteria(); 
     
    16991130            } 
    17001131        } else { 
    1701             // the following code is to determine if a new query is 
    1702             // called for.  If the criteria is the same as the last 
    1703             // one, just return the collection. 
    1704  
     1132                                     
    17051133            $criteria->add(QuestionTagPeer::QUESTION_ID, $this->getId()); 
    17061134 
     
    17141142    } 
    17151143 
    1716     /** 
    1717      * Temporary storage of collSearchIndexs to save a possible db hit in 
    1718      * the event objects are add to the collection, but the 
    1719      * complete collection is never requested. 
    1720      * @return void 
    1721      */ 
     1144     
    17221145    public function initSearchIndexs() 
    17231146    { 
     
    17271150    } 
    17281151 
    1729     /** 
    1730      * If this collection has already been initialized with 
    1731      * an identical criteria, it returns the collection. 
    1732      * Otherwise if this Question has previously 
    1733      * been saved, it will retrieve related SearchIndexs from storage. 
    1734      * If this Question is new, it will return 
    1735      * an empty collection or the current collection, the criteria 
    1736      * is ignored on a new object. 
    1737      * 
    1738      * @param Connection $con 
    1739      * @param Criteria $criteria 
    1740      * @throws PropelException 
    1741      */ 
     1152     
    17421153    public function getSearchIndexs($criteria = null, $con = null) 
    17431154    { 
    1744         // include the Peer class 
    1745         include_once 'model/om/BaseSearchIndexPeer.php'; 
     1155                include_once 'lib/model/om/BaseSearchIndexPeer.php'; 
    17461156        if ($criteria === null) { 
    17471157            $criteria = new Criteria(); 
     
    17631173            } 
    17641174        } else { 
    1765             // criteria has no effect for a new object 
    1766             if (!$this->isNew()) { 
    1767                 // the following code is to determine if a new query is 
    1768                 // called for.  If the criteria is the same as the last 
    1769                 // one, just return the collection. 
    1770  
     1175                        if (!$this->isNew()) { 
     1176                                                 
    17711177 
    17721178                $criteria->add(SearchIndexPeer::QUESTION_ID, $this->getId()); 
     
    17821188    } 
    17831189 
    1784     /** 
    1785      * Returns the number of related SearchIndexs. 
    1786      * 
    1787      * @param Criteria $criteria 
    1788      * @param boolean $distinct 
    1789      * @param Connection $con 
    1790      * @throws PropelException 
    1791      */ 
     1190     
    17921191    public function countSearchIndexs($criteria = null, $distinct = false, $con = null) 
    17931192    { 
    1794         // include the Peer class 
    1795         include_once 'model/om/BaseSearchIndexPeer.php'; 
     1193                include_once 'lib/model/om/BaseSearchIndexPeer.php'; 
    17961194        if ($criteria === null) { 
    17971195            $criteria = new Criteria(); 
     
    18071205    } 
    18081206 
    1809     /** 
    1810      * Method called to associate a SearchIndex object to this object 
    1811      * through the SearchIndex foreign key attribute 
    1812      * 
    1813      * @param SearchIndex $l SearchIndex 
    1814      * @return void 
    1815      * @throws PropelException 
    1816      */ 
     1207     
    18171208    public function addSearchIndex(SearchIndex $l) 
    18181209    { 
     
    18211212    } 
    18221213 
    1823     /** 
    1824      * Temporary storage of collReportQuestions to save a possible db hit in 
    1825      * the event objects are add to the collection, but the 
    1826      * complete collection is never requested. 
    1827      * @return void 
    1828      */ 
     1214     
    18291215    public function initReportQuestions() 
    18301216    { 
     
    18341220    } 
    18351221 
    1836     /** 
    1837      * If this collection has already been initialized with 
    1838      * an identical criteria, it returns the collection. 
    1839      * Otherwise if this Question has previously 
    1840      * been saved, it will retrieve related ReportQuestions from storage. 
    1841      * If this Question is new, it will return 
    1842      * an empty collection or the current collection, the criteria 
    1843      * is ignored on a new object. 
    1844      * 
    1845      * @param Connection $con 
    1846      * @param Criteria $criteria 
    1847      * @throws PropelException 
    1848      */ 
     1222     
    18491223    public function getReportQuestions($criteria = null, $con = null) 
    18501224    { 
    1851         // include the Peer class 
    1852         include_once 'model/om/BaseReportQuestionPeer.php'; 
     1225                include_once 'lib/model/om/BaseReportQuestionPeer.php'; 
    18531226        if ($criteria === null) { 
    18541227            $criteria = new Criteria(); 
     
    18701243            } 
    18711244        } else { 
    1872             // criteria has no effect for a new object 
    1873             if (!$this->isNew()) { 
    1874                 // the following code is to determine if a new query is 
    1875                 // called for.  If the criteria is the same as the last 
    1876                 // one, just return the collection. 
    1877  
     1245                        if (!$this->isNew()) { 
     1246                                                 
    18781247 
    18791248                $criteria->add(ReportQuestionPeer::QUESTION_ID, $this->getId()); 
     
    18891258    } 
    18901259 
    1891     /** 
    1892      * Returns the number of related ReportQuestions. 
    1893      * 
    1894      * @param Criteria $criteria 
    1895      * @param boolean $distinct 
    1896      * @param Connection $con 
    1897      * @throws PropelException 
    1898      */ 
     1260     
    18991261    public function countReportQuestions($criteria = null, $distinct = false, $con = null) 
    19001262    { 
    1901         // include the Peer class 
    1902         include_once 'model/om/BaseReportQuestionPeer.php'; 
     1263                include_once 'lib/model/om/BaseReportQuestionPeer.php'; 
    19031264        if ($criteria === null) { 
    19041265            $criteria = new Criteria(); 
     
    19141275    } 
    19151276 
    1916     /** 
    1917      * Method called to associate a ReportQuestion object to this object 
    1918      * through the ReportQuestion foreign key attribute 
    1919      * 
    1920      * @param ReportQuestion $l ReportQuestion 
    1921      * @return void 
    1922      * @throws PropelException 
    1923      */ 
     1277     
    19241278    public function addReportQuestion(ReportQuestion $l) 
    19251279    { 
     
    19291283 
    19301284 
    1931     /** 
    1932      * If this collection has already been initialized with 
    1933      * an identical criteria, it returns the collection. 
    1934      * Otherwise if this Question is new, it will return 
    1935      * an empty collection; or if this Question has previously 
    1936      * been saved, it will retrieve related ReportQuestions from storage. 
    1937      * 
    1938      * This method is protected by default in order to keep the public 
    1939      * api reasonable.  You can provide public methods for those you 
    1940      * actually need in Question. 
    1941      */ 
     1285     
    19421286    public function getReportQuestionsJoinUser($criteria = null, $con = null) 
    19431287    { 
    1944         // include the Peer class 
    1945         include_once 'model/om/BaseReportQuestionPeer.php'; 
     1288                include_once 'lib/model/om/BaseReportQuestionPeer.php'; 
    19461289        if ($criteria === null) { 
    19471290            $criteria = new Criteria(); 
     
    19621305            } 
    19631306        } else { 
    1964             // the following code is to determine if a new query is 
    1965             // called for.  If the criteria is the same as the last 
    1966             // one, just return the collection. 
    1967  
     1307                                     
    19681308            $criteria->add(ReportQuestionPeer::QUESTION_ID, $this->getId()); 
    19691309 
     
    19771317    } 
    19781318 
    1979 } // BaseQuestion 
     1319}  
  • trunk/lib/model/om/BaseQuestionPeer.php

    r74 r88  
    11<?php 
    22 
    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  
    8 /** 
    9  * Base static class for performing query and update operations on the 'ask_question' table. 
    10  * 
    11  *  
    12  * 
    13  * @package model.om 
    14  */ 
     3 
    154abstract class BaseQuestionPeer { 
    165 
    17     /** the default database name for this class */ 
     6     
    187    const DATABASE_NAME = 'symfony'; 
    198 
    20     /** the table name for this class */ 
     9     
    2110    const TABLE_NAME = 'ask_question'; 
    2211 
    23     /** A class that can be returned by this peer. */ 
    24     const CLASS_DEFAULT = 'model.Question'; 
    25  
    26     /** The total number of columns. */ 
     12     
     13    const CLASS_DEFAULT = 'lib.model.Question'; 
     14 
     15     
    2716    const NUM_COLUMNS = 10; 
    2817 
    29     /** The number of lazy-loaded columns. */ 
     18     
    3019    const NUM_LAZY_LOAD_COLUMNS = 0; 
    3120 
    3221 
    33     /** the column name for the ID field */ 
     22     
    3423    const ID = 'ask_question.ID'; 
    3524 
    36     /** the column name for the USER_ID field */ 
     25     
    3726    const USER_ID = 'ask_question.USER_ID'; 
    3827 
    39     /** the column name for the TITLE field */ 
     28     
    4029    const TITLE = 'ask_question.TITLE'; 
    4130 
    42     /** the column name for the STRIPPED_TITLE field */ 
     31     
    4332    const STRIPPED_TITLE = 'ask_question.STRIPPED_TITLE'; 
    4433 
    45     /** the column name for the BODY field */ 
     34     
    4635    const BODY = 'ask_question.BODY'; 
    4736 
    48     /** the column name for the HTML_BODY field */ 
     37     
    4938    const HTML_BODY = 'ask_question.HTML_BODY'; 
    5039 
    51     /** the column name for the INTERESTED_USERS field */ 
     40     
    5241    const INTERESTED_USERS = 'ask_question.INTERESTED_USERS'; 
    5342 
    54     /** the column name for the REPORTS field */ 
     43     
    5544    const REPORTS = 'ask_question.REPORTS'; 
    5645 
    57     /** the column name for the CREATED_AT field */ 
     46     
    5847    const CREATED_AT = 'ask_question.CREATED_AT'; 
    5948 
    60     /** the column name for the UPDATED_AT field */ 
     49     
    6150    const UPDATED_AT = 'ask_question.UPDATED_AT'; 
    6251 
    63     /** The PHP to DB Name Mapping */ 
     52     
    6453    private static $phpNameMap = null; 
    6554 
    6655 
    67     /** 
    68      * holds an array of fieldnames 
    69      * 
    70      * first dimension keys are the type constants 
    71      * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' 
    72      */ 
     56     
    7357    private static $fieldNames = array ( 
    7458        BasePeer::TYPE_PHPNAME => array ('Id', 'UserId', 'Title', 'StrippedTitle', 'Body', 'HtmlBody', 'InterestedUsers', 'Reports', 'CreatedAt', 'UpdatedAt', ), 
     
    7862    ); 
    7963 
    80     /** 
    81      * holds an array of keys for quick access to the fieldnames array 
    82      * 
    83      * first dimension keys are the type constants 
    84      * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 
    85      */ 
     64     
    8665    private static $fieldKeys = array ( 
    8766        BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'UserId' => 1, 'Title' => 2, 'StrippedTitle' => 3, 'Body' => 4, 'HtmlBody' => 5, 'InterestedUsers' => 6, 'Reports' => 7, 'CreatedAt' => 8, 'UpdatedAt' => 9, ), 
     
    9170    ); 
    9271 
    93     /** 
    94      * @return MapBuilder the map builder for this peer 
    95      * @throws PropelException Any exceptions caught during processing will be 
    96      *       rethrown wrapped into a PropelException. 
    97      */ 
     72     
    9873    public static function getMapBuilder() 
    9974    { 
    100         include_once 'model/map/QuestionMapBuilder.php'; 
    101         return BasePeer::getMapBuilder('model.map.QuestionMapBuilder'); 
    102     } 
    103     /** 
    104      * Gets a map (hash) of PHP names to DB column names. 
    105      * 
    106      * @return array The PHP to DB name map for this peer 
    107      * @throws PropelException Any exceptions caught during processing will be 
    108      *       rethrown wrapped into a PropelException. 
    109      * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. 
    110      */ 
     75        include_once 'lib/model/map/QuestionMapBuilder.php'; 
     76        return BasePeer::getMapBuilder('lib.model.map.QuestionMapBuilder'); 
     77    } 
     78     
    11179    public static function getPhpNameMap() 
    11280    { 
     
    12290        return self::$phpNameMap; 
    12391    } 
    124     /** 
    125      * Translates a fieldname to another type 
    126      * 
    127      * @param string $name field name 
    128      * @param string $fromType One of the class type constants TYPE_PHPNAME, 
    129      *                         TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM 
    130      * @param string $toType   One of the class type constants 
    131      * @return string translated name of the field. 
    132      */ 
     92     
    13393    static public function translateFieldName($name, $fromType, $toType) 
    13494    { 
     
    141101    } 
    142102 
    143     /** 
    144      * Returns an array of of field names. 
    145      * 
    146      * @param  string $type The type of fieldnames to return: 
    147      *                      One of the class type constants TYPE_PHPNAME, 
    148      *                      TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM 
    149      * @return array A list of field names 
    150      */ 
     103     
    151104 
    152105    static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) 
     
    158111    } 
    159112 
    160     /** 
    161      * Convenience method which changes table.column to alias.column. 
    162      * 
    163      * Using this method you can maintain SQL abstraction while using column aliases. 
    164      * <code> 
    165      *      $c->addAlias("alias1", TablePeer::TABLE_NAME); 
    166      *      $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); 
    167      * </code> 
    168      * @param string $alias The alias for the current table. 
    169      * @param string $column The column name for current table. (i.e. QuestionPeer::COLUMN_NAME). 
    170      * @return string 
    171      */ 
     113     
    172114    public static function alias($alias, $column) 
    173115    { 
     
    175117    } 
    176118 
    177     /** 
    178      * Add all the columns needed to create a new object. 
    179      * 
    180      * Note: any columns that were marked with lazyLoad="true" in the 
    181      * XML schema will not be added to the select list and only loaded 
    182      * on demand. 
    183      * 
    184      * @param criteria object containing the columns to add. 
    185      * @throws PropelException Any exceptions caught during processing will be 
    186      *       rethrown wrapped into a PropelException. 
    187      */ 
     119     
    188120    public static function addSelectColumns(Criteria $criteria) 
    189121    { 
     
    214146    const COUNT_DISTINCT = 'COUNT(DISTINCT ask_question.ID)'; 
    215147 
    216     /** 
    217      * Returns the number of rows matching criteria. 
    218      * 
    219      * @param Criteria $criteria 
    220      * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). 
    221      * @param Connection $con 
    222      * @return int Number of matching rows. 
    223      */ 
     148     
    224149    public static function doCount(Criteria $criteria, $distinct = false, $con = null) 
    225150    { 
    226         // we're going to modify criteria, so copy it first 
    227         $criteria = clone $criteria; 
    228  
    229         // clear out anything that might confuse the ORDER BY clause 
    230         $criteria->clearSelectColumns()->clearOrderByColumns(); 
     151                $criteria = clone $criteria; 
     152 
     153                $criteria->clearSelectColumns()->clearOrderByColumns(); 
    231154        if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { 
    232155            $criteria->addSelectColumn(QuestionPeer::COUNT_DISTINCT); 
     
    235158        } 
    236159 
    237         // just in case we're grouping: add those columns to the select statement 
    238         foreach($criteria->getGroupByColumns() as $column) 
     160                foreach($criteria->getGroupByColumns() as $column) 
    239161        { 
    240162            $criteria->addSelectColumn($column); 
     
    245167            return $rs->getInt(1); 
    246168        } else { 
    247             // no rows returned; we infer that means 0 matches. 
    248             return 0; 
    249         } 
    250     } 
    251     /** 
    252      * Method to select one object from the DB. 
    253      * 
    254      * @param Criteria $criteria object used to create the SELECT statement. 
    255      * @param Connection $con 
    256      * @return Question 
    257      * @throws PropelException Any exceptions caught during processing will be 
    258      *       rethrown wrapped into a PropelException. 
    259      */ 
     169                        return 0; 
     170        } 
     171    } 
     172     
    260173    public static function doSelectOne(Criteria $criteria, $con = null) 
    261174    { 
     
    268181        return null; 
    269182    } 
    270     /** 
    271      * Method to do selects. 
    272      * 
    273      * @param Criteria $criteria The Criteria object used to build the SELECT statement. 
    274      * @param Connection $con 
    275      * @return array Array of selected Objects 
    276      * @throws PropelException Any exceptions caught during processing will be 
    277      *       rethrown wrapped into a PropelException. 
    278      */ 
     183     
    279184    public static function doSelect(Criteria $criteria, $con = null) 
    280185    { 
    281186        return QuestionPeer::populateObjects(QuestionPeer::doSelectRS($criteria, $con)); 
    282187    } 
    283     /** 
    284      * Prepares the Criteria object and uses the parent doSelect() 
    285      * method to get a ResultSet. 
    286      * 
    287      * Use this method directly if you want to just get the resultset 
    288      * (instead of an array of objects). 
    289      * 
    290      * @param Criteria $criteria The Criteria object used to build the SELECT statement. 
    291      * @param Connection $con the connection to use 
    292      * @throws PropelException Any exceptions caught during processing will be 
    293      *       rethrown wrapped into a PropelException. 
    294      * @return ResultSet The resultset object with numerically-indexed fields. 
    295      * @see BasePeer::doSelect() 
    296      */ 
     188     
    297189    public static function doSelectRS(Criteria $criteria, $con = null) 
    298190    { 
     
    306198        } 
    307199 
    308         // Set the correct dbName 
    309         $criteria->setDbName(self::DATABASE_NAME); 
    310  
    311         // BasePeer returns a Creole ResultSet, set to return 
    312         // rows indexed numerically. 
    313         return BasePeer::doSelect($criteria, $con); 
    314     } 
    315     /** 
    316      * The returned array will contain objects of the default type or 
    317      * objects that inherit from the default. 
    318      * 
    319      * @throws PropelException Any exceptions caught during processing will be 
    320      *       rethrown wrapped into a PropelException. 
    321      */ 
     200                $criteria->setDbName(self::DATABASE_NAME); 
     201 
     202                        return BasePeer::doSelect($criteria, $con); 
     203    } 
     204     
    322205    public static function populateObjects(ResultSet $rs) 
    323206    { 
    324207        $results = array(); 
    325208     
    326         // set the class once to avoid overhead in the loop 
    327         $cls = QuestionPeer::getOMClass(); 
     209                $cls = QuestionPeer::getOMClass(); 
    328210        $cls = Propel::import($cls); 
    329         // populate the object(s) 
    330         while($rs->next()) { 
     211                while($rs->next()) { 
    331212         
    332213            $obj = new $cls(); 
     
    338219    } 
    339220 
    340     /** 
    341      * Returns the number of rows matching criteria, joining the related User table 
    342      * 
    343      * @param Criteria $c 
    344      * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). 
    345      * @param Connection $con 
    346      * @return int Number of matching rows. 
    347      */ 
     221     
    348222    public static function doCountJoinUser(Criteria $criteria, $distinct = false, $con = null) 
    349223    { 
    350         // we're going to modify criteria, so copy it first 
    351         $criteria = clone $criteria; 
     224                $criteria = clone $criteria; 
    352225         
    353         // clear out anything that might confuse the ORDER BY clause 
    354         $criteria->clearSelectColumns()->clearOrderByColumns(); 
     226                $criteria->clearSelectColumns()->clearOrderByColumns(); 
    355227        if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { 
    356228            $criteria->addSelectColumn(QuestionPeer::COUNT_DISTINCT); 
     
    359231        } 
    360232         
    361         // just in case we're grouping: add those columns to the select statement 
    362         foreach($criteria->getGroupByColumns() as $column) 
     233                foreach($criteria->getGroupByColumns() as $column) 
    363234        { 
    364235            $criteria->addSelectColumn($column); 
     
    371242            return $rs->getInt(1); 
    372243        } else { 
    373             // no rows returned; we infer that means 0 matches. 
    374             return 0; 
    375         } 
    376     } 
    377  
    378  
    379     /** 
    380      * Selects a collection of Question objects pre-filled with their User objects. 
    381      * 
    382      * @return array Array of Question objects. 
    383      * @throws PropelException Any exceptions caught during processing will be 
    384      *       rethrown wrapped into a PropelException. 
    385      */ 
     244                        return 0; 
     245        } 
     246    } 
     247 
     248 
     249     
    386250    public static function doSelectJoinUser(Criteria $c, $con = null) 
    387251    { 
    388252        $c = clone $c; 
    389253 
    390         // Set the correct dbName if it has not been overridden 
    391         if ($c->getDbName() == Propel::getDefaultDB()) { 
     254                if ($c->getDbName() == Propel::getDefaultDB()) { 
    392255            $c->setDbName(self::DATABASE_NAME); 
    393256        } 
     
    417280            $newObject = true; 
    418281            foreach($results as $temp_obj1) { 
    419                 $temp_obj2 = $temp_obj1->getUser(); //CHECKME 
    420                 if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { 
     282                $temp_obj2 = $temp_obj1->getUser();                 if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { 
    421283                    $newObject = false; 
    422                     // e.g. $author->addBookRelatedByBookId() 
    423                     $temp_obj2->addQuestion($obj1); //CHECKME 
    424                     break; 
     284                                        $temp_obj2->addQuestion($obj1);                     break; 
    425285                } 
    426286            } 
    427287            if ($newObject) { 
    428288                $obj2->initQuestions(); 
    429                 $obj2->addQuestion($obj1); //CHECKME 
    430             } 
     289                $obj2->addQuestion($obj1);          } 
    431290            $results[] = $obj1; 
    432291        } 
     
    435294 
    436295 
    437     /** 
    438      * Returns the number of rows matching criteria, joining all related tables 
    439      * 
    440      * @param Criteria $c 
    441      * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). 
    442      * @param Connection $con 
    443      * @return int Number of matching rows. 
    444      */ 
     296     
    445297    public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null) 
    446298    { 
    447299        $criteria = clone $criteria; 
    448300 
    449         // clear out anything that might confuse the ORDER BY clause 
    450         $criteria->clearSelectColumns()->clearOrderByColumns(); 
     301                $criteria->clearSelectColumns()->clearOrderByColumns(); 
    451302        if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { 
    452303            $criteria->addSelectColumn(QuestionPeer::COUNT_DISTINCT); 
     
    455306        } 
    456307         
    457         // just in case we're grouping: add those columns to the select statement 
    458         foreach($criteria->getGroupByColumns() as $column) 
     308                foreach($criteria->getGroupByColumns() as $column) 
    459309        { 
    460310            $criteria->addSelectColumn($column); 
     
    467317            return $rs->getInt(1); 
    468318        } else { 
    469             // no rows returned; we infer that means 0 matches. 
    470             return 0; 
    471         } 
    472     } 
    473  
    474  
    475     /** 
    476      * Selects a collection of Question objects pre-filled with all related objects. 
    477      * 
    478      * @return array Array of Question objects. 
    479      * @throws PropelException Any exceptions caught during processing will be 
    480      *       rethrown wrapped into a PropelException. 
    481      */ 
     319                        return 0; 
     320        } 
     321    } 
     322 
     323 
     324     
    482325    public static function doSelectJoinAll(Criteria $c, $con = null) 
    483326    { 
    484327        $c = clone $c; 
    485328 
    486         // Set the correct dbName if it has not been overridden 
    487         if ($c->getDbName() == Propel::getDefaultDB()) { 
     329                if ($c->getDbName() == Propel::getDefaultDB()) { 
    488330            $c->setDbName(self::DATABASE_NAME); 
    489331        } 
     
    510352 
    511353                 
    512                 // Add objects for joined User rows 
    513      
     354                     
    514355            $omClass = UserPeer::getOMClass(); 
    515356 
     
    522363            for ($j=0, $resCount=count($results); $j < $resCount; $j++) { 
    523364                $temp_obj1 = $results[$j]; 
    524                 $temp_obj2 = $temp_obj1->getUser(); // CHECKME 
    525                 if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { 
     365                $temp_obj2 = $temp_obj1->getUser();                 if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { 
    526366                    $newObject = false; 
    527                     $temp_obj2->addQuestion($obj1); // CHECKME 
    528                     break; 
     367                    $temp_obj2->addQuestion($obj1);                     break; 
    529368                } 
    530369            } 
     
    540379    } 
    541380 
    542     /** 
    543      * Returns the TableMap related to this peer. 
    544      * This method is not needed for general use but a specific application could have a need. 
    545      * @return TableMap 
    546      * @throws PropelException Any exceptions caught during processing will be 
    547      *       rethrown wrapped into a PropelException. 
    548      */ 
     381     
    549382    public static function getTableMap() 
    550383    { 
     
    552385    } 
    553386 
    554     /** 
    555      * The class that the Peer will make instances of. 
    556      * 
    557      * This uses a dot-path notation which is tranalted into a path 
    558      * relative to a location on the PHP include_path. 
    559      * (e.g. path.to.MyClass -> 'path/to/MyClass.php') 
    560      * 
    561      * @return string path.to.ClassName 
    562      */ 
     387     
    563388    public static function getOMClass() 
    564389    { 
     
    566391    } 
    567392 
    568     /** 
    569      * Method perform an INSERT on the database, given a Question or Criteria object. 
    570      * 
    571      * @param mixed $values Criteria or Question object containing data that is used to create the INSERT statement. 
    572      * @param Connection $con the connection to use 
    573      * @return mixed The new primary key. 
    574      * @throws PropelException Any exceptions caught during processing will be 
    575      *       rethrown wrapped into a PropelException. 
    576      */ 
     393     
    577394    public static function doInsert($values, $con = null) 
    578395    { 
     
    582399 
    583400        if ($values instanceof Criteria) { 
    584             $criteria = clone $values; // rename for clarity 
    585         } else { 
    586             $criteria = $values->buildCriteria(); // build Criteria from Question object 
    587         } 
    588  
    589         $criteria->remove(QuestionPeer::ID); // remove pkey col since this table uses auto-increment 
    590  
    591  
    592         // Set the correct dbName 
    593         $criteria->setDbName(self::DATABASE_NAME); 
     401            $criteria = clone $values;      } else { 
     402            $criteria = $values->buildCriteria();       } 
     403 
     404        $criteria->remove(QuestionPeer::ID);  
     405 
     406                $criteria->setDbName(self::DATABASE_NAME); 
    594407 
    595408        try { 
    596             // use transaction because $criteria could contain info 
    597             // for more than one table (I guess, conceivably) 
    598             $con->begin(); 
     409                                    $con->begin(); 
    599410            $pk = BasePeer::doInsert($criteria, $con); 
    600411            $con->commit(); 
     
    607418    } 
    608419 
    609     /** 
    610      * Method perform an UPDATE on the database, given a Question or Criteria object. 
    611      * 
    612      * @param mixed $values Criteria or Question object containing data that is used to create the UPDATE statement. 
    613      * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). 
    614      * @return int The number of affected rows (if supported by underlying database driver). 
    615      * @throws PropelException Any exceptions caught during processing will be 
    616      *       rethrown wrapped into a PropelException. 
    617      */ 
     420     
    618421    public static function doUpdate($values, $con = null) 
    619422    { 
     
    625428 
    626429        if ($values instanceof Criteria) { 
    627             $criteria = clone $values; // rename for clarity 
    628  
     430            $criteria = clone $values;  
    629431            $comparison = $criteria->getComparison(QuestionPeer::ID); 
    630432            $selectCriteria->add(QuestionPeer::ID, $criteria->remove(QuestionPeer::ID), $comparison); 
    631433 
    632         } else { // $values is Question object 
    633             $criteria = $values->buildCriteria(); // gets full criteria 
    634             $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) 
    635         } 
    636  
    637         // set the correct dbName 
    638         $criteria->setDbName(self::DATABASE_NAME); 
     434        } else {            $criteria = $values->buildCriteria();           $selectCriteria = $values->buildPkeyCriteria();         } 
     435 
     436                $criteria->setDbName(self::DATABASE_NAME); 
    639437 
    640438        return BasePeer::doUpdate($selectCriteria, $criteria, $con); 
    641439    } 
    642440 
    643     /** 
    644      * Method to DELETE all rows from the ask_question table. 
    645      * 
    646      * @return int The number of affected rows (if supported by underlying database driver). 
    647      */ 
     441     
    648442    public static function doDeleteAll($con = null) 
    649443    { 
     
    651445            $con = Propel::getConnection(self::DATABASE_NAME); 
    652446        } 
    653         $affectedRows = 0; // initialize var to track total num of affected rows 
    654         try { 
    655             // use transaction because $criteria could contain info 
    656             // for more than one table or we could emulating ON DELETE CASCADE, etc. 
    657             $con->begin(); 
     447        $affectedRows = 0;      try { 
     448                                    $con->begin(); 
    658449            $affectedRows += BasePeer::doDeleteAll(QuestionPeer::TABLE_NAME, $con); 
    659450            $con->commit(); 
     
    665456    } 
    666457 
    667     /** 
    668      * Method perform a DELETE on the database, given a Question or Criteria object OR a primary key value. 
    669      * 
    670      * @param mixed $values Criteria or Question object or primary key or array of primary keys 
    671      *              which is used to create the DELETE statement 
    672      * @param Connection $con the connection to use 
    673      * @return int  The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows 
    674      *              if supported by native driver or if emulated using Propel. 
    675      * @throws PropelException Any exceptions caught during processing will be 
    676      *       rethrown wrapped into a PropelException. 
    677      */ 
     458     
    678459     public static function doDelete($values, $con = null) 
    679460     { 
     
    683464 
    684465        if ($values instanceof Criteria) { 
    685             $criteria = clone $values; // rename for clarity 
    686         } elseif ($values instanceof Question) { 
     466            $criteria = clone $values;      } elseif ($values instanceof Question) { 
    687467 
    688468            $criteria = $values->buildPkeyCriteria(); 
    689469        } else { 
    690             // it must be the primary key 
    691             $criteria = new Criteria(self::DATABASE_NAME); 
     470                        $criteria = new Criteria(self::DATABASE_NAME); 
    692471            $criteria->add(QuestionPeer::ID, (array) $values, Criteria::IN); 
    693472        } 
    694473 
    695         // Set the correct dbName 
    696         $criteria->setDbName(self::DATABASE_NAME); 
    697  
    698         $affectedRows = 0; // initialize var to track total num of affected rows 
    699  
     474                $criteria->setDbName(self::DATABASE_NAME); 
     475 
     476        $affectedRows = 0;  
    700477        try { 
    701             // use transaction because $criteria could contain info 
    702             // for more than one table or we could emulating ON DELETE CASCADE, etc. 
    703             $con->begin(); 
     478                                    $con->begin(); 
    704479             
    705480            $affectedRows += BasePeer::doDelete($criteria, $con); 
     
    712487    } 
    713488 
    714     /** 
    715      * Validates all modified columns of given Question object. 
    716      * If parameter $columns is either a single column name or an array of column names 
    717      * than only those columns are validated. 
    718      * 
    719      * NOTICE: This does not apply to primary or foreign keys for now. 
    720      * 
    721      * @param Question $obj The object to validate. 
    722      * @param mixed $cols Column name or array of column names. 
    723      * 
    724      * @return mixed TRUE if all columns are valid or the error message of the first invalid column. 
    725      */ 
     489     
    726490    public static function doValidate(Question $obj, $cols = null) 
    727491    { 
     
    758522    } 
    759523 
    760     /** 
    761      * Retrieve a single object by pkey. 
    762      * 
    763      * @param mixed $pk the primary key. 
    764      * @param Connection $con the connection to use 
    765      * @return Question 
    766      */ 
     524     
    767525    public static function retrieveByPK($pk, $con = null) 
    768526    { 
     
    777535 
    778536        $v = QuestionPeer::doSelect($criteria, $con); 
    779         return !empty($v) > 0 ? $v[0] : null; 
    780     } 
    781  
    782     /** 
    783      * Retrieve multiple objects by pkey. 
    784      * 
    785      * @param array $pks List of primary keys 
    786      * @param Connection $con the connection to use 
    787      * @throws PropelException Any exceptions caught during processing will be 
    788      *       rethrown wrapped into a PropelException. 
    789      */ 
     537 
     538        return !empty($v) > 0 ? $v[0] : null; 
     539    } 
     540 
     541     
    790542    public static function retrieveByPKs($pks, $con = null) 
    791543    { 
     
    805557    } 
    806558 
    807 } // BaseQuestionPeer 
    808  
    809 // static code to register the map builder for this Peer with the main Propel class 
     559}  
    810560if (Propel::isInit()) { 
    811     // the MapBuilder classes register themselves with Propel during initialization 
    812     // so we need to load them here. 
    813     try { 
     561            try { 
    814562        BaseQuestionPeer::getMapBuilder(); 
    815563    } catch (Exception $e) { 
     
    817565    } 
    818566} else { 
    819     // even if Propel is not yet initialized, the map builder class can be registered 
    820     // now and then it will be loaded when Propel initializes. 
    821     require_once 'model/map/QuestionMapBuilder.php'; 
    822     Propel::registerMapBuilder('model.map.QuestionMapBuilder'); 
     567            require_once 'lib/model/map/QuestionMapBuilder.php'; 
     568    Propel::registerMapBuilder('lib.model.map.QuestionMapBuilder'); 
    823569} 
  • trunk/lib/model/om/BaseQuestionTag.php

    r74 r88  
    11<?php 
    22 
    3 require_once 'propel/om/BaseObject.php'; 
    4  
    5 require_once 'propel/om/Persistent.php'; 
    6  
    7  
    8 include_once 'propel/util/Criteria.php'; 
    9  
    10 include_once 'model/QuestionTagPeer.php'; 
    11  
    12 /** 
    13  * Base class that represents a row from the 'ask_question_tag' table. 
    14  * 
    15  *  
    16  * 
    17  * @package model.om 
    18  */ 
     3 
    194abstract class BaseQuestionTag extends BaseObject  implements Persistent { 
    205 
    216 
    22     /** 
    23      * The Peer class. 
    24      * Instance provides a convenient way of calling static methods on a class 
    25      * that calling code may not be able to identify. 
    26      * @var QuestionTagPeer 
    27      */ 
     7     
     8    const DATABASE_NAME = 'symfony'; 
     9 
     10     
    2811    protected static $peer; 
    2912 
    3013 
    31     /** 
    32      * The value for the question_id field. 
    33      * @var int 
    34      */ 
     14     
    3515    protected $question_id; 
    3616 
    3717 
    38     /** 
    39      * The value for the user_id field. 
    40      * @var int 
    41      */ 
     18     
    4219    protected $user_id; 
    4320 
    4421 
    45     /** 
    46      * The value for the created_at field. 
    47      * @var int 
    48      */ 
     22     
    4923    protected $created_at; 
    5024 
    5125 
    52     /** 
    53      * The value for the tag field. 
    54      * @var string 
    55      */ 
     26     
    5627    protected $tag; 
    5728 
    5829 
    59     /** 
    60      * The value for the normalized_tag field. 
    61      * @var string 
    62      */ 
     30     
    6331    protected $normalized_tag; 
    6432 
    65     /** 
    66      * @var Question 
    67      */ 
     33     
    6834    protected $aQuestion; 
    6935 
    70     /** 
    71      * @var User 
    72      */ 
     36     
    7337    protected $aUser; 
    7438 
    75     /** 
    76      * Flag to prevent endless save loop, if this object is referenced 
    77      * by another object which falls in this transaction. 
    78      * @var boolean 
    79      */ 
     39     
    8040    protected $alreadyInSave = false; 
    8141 
    82     /** 
    83      * Flag to prevent endless validation loop, if this object is referenced 
    84      * by another object which falls in this transaction. 
    85      * @var boolean 
    86      */ 
     42     
    8743    protected $alreadyInValidation = false; 
    8844 
    89     /** 
    90      * Get the [question_id] column value. 
    91      *  
    92      * @return int 
    93      */ 
     45     
    9446    public function getQuestionId() 
    9547    { 
     
    9850    } 
    9951 
    100     /** 
    101      * Get the [user_id] column value. 
    102      *  
    103      * @return int 
    104      */ 
     52     
    10553    public function getUserId() 
    10654    { 
     
    10957    } 
    11058 
    111     /** 
    112      * Get the [optionally formatted] [created_at] column value. 
    113      *  
    114      * @param string $format The date/time format string (either date()-style or strftime()-style). 
    115      *                          If format is NULL, then the integer unix timestamp will be returned. 
    116      * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). 
    117      * @throws PropelException - if unable to convert the date/time to timestamp. 
    118      */ 
     59     
    11960    public function getCreatedAt($format = 'Y-m-d H:i:s') 
    12061    { 
     
    12364            return null; 
    12465        } elseif (!is_int($this->created_at)) { 
    125             // a non-timestamp value was set externally, so we convert it 
    126             $ts = strtotime($this->created_at); 
    127             if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE 
    128                 throw new PropelException("Unable to parse value of [created_at] as date/time value: " . var_export($this->created_at, true)); 
     66                        $ts = strtotime($this->created_at); 
     67            if ($ts === -1 || $ts === false) {              throw new PropelException("Unable to parse value of [created_at] as date/time value: " . var_export($this->created_at, true)); 
    12968            } 
    13069        } else { 
     
    14079    } 
    14180 
    142     /** 
    143      * Get the [tag] column value. 
    144      *  
    145      * @return string 
    146      */ 
     81     
    14782    public function getTag() 
    14883    { 
     
    15186    } 
    15287 
    153     /** 
    154      * Get the [normalized_tag] column value. 
    155      *  
    156      * @return string 
    157      */ 
     88     
    15889    public function getNormalizedTag() 
    15990    { 
     
    16293    } 
    16394 
    164     /** 
    165      * Set the value of [question_id] column. 
    166      *  
    167      * @param int $v new value 
    168      * @return void 
    169      */ 
     95     
    17096    public function setQuestionId($v) 
    17197    { 
     
    178104        if ($this->aQuestion !== null && $this->aQuestion->getId() !== $v) { 
    179105            $this->aQuestion = null; 
    180         }        
    181  
    182     } // setQuestionId() 
    183  
    184     /** 
    185      * Set the value of [user_id] column. 
    186      *  
    187      * @param int $v new value 
    188      * @return void 
    189      */ 
     106        } 
     107 
     108    }  
     109     
    190110    public function setUserId($v) 
    191111    { 
     
    198118        if ($this->aUser !== null && $this->aUser->getId() !== $v) { 
    199119            $this->aUser = null; 
    200         }        
    201  
    202     } // setUserId() 
    203  
    204     /** 
    205      * Set the value of [created_at] column. 
    206      *  
    207      * @param int $v new value 
    208      * @return void 
    209      */ 
     120        } 
     121 
     122    }  
     123     
    210124    public function setCreatedAt($v) 
    211125    { 
     
    213127        if ($v !== null && !is_int($v)) { 
    214128            $ts = strtotime($v); 
    215             if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE 
    216                 throw new PropelException("Unable to parse date/time value for [created_at] from input: " . var_export($v, true)); 
     129            if ($ts === -1 || $ts === false) {              throw new PropelException("Unable to parse date/time value for [created_at] from input: " . var_export($v, true)); 
    217130            } 
    218131        } else { 
     
    224137        } 
    225138 
    226     } // setCreatedAt() 
    227  
    228     /** 
    229      * Set the value of [tag] column. 
    230      *  
    231      * @param string $v new value 
    232      * @return void 
    233      */ 
     139    }  
     140     
    234141    public function setTag($v) 
    235142    { 
     
    240147        } 
    241148 
    242     } // setTag() 
    243  
    244     /** 
    245      * Set the value of [normalized_tag] column. 
    246      *  
    247      * @param string $v new value 
    248      * @return void 
    249      */ 
     149    }  
     150     
    250151    public function setNormalizedTag($v) 
    251152    { 
     
    256157        } 
    257158 
    258     } // setNormalizedTag() 
    259  
    260     /** 
    261      * Hydrates (populates) the object variables with values from the database resultset. 
    262      * 
    263      * An offset (1-based "start column") is specified so that objects can be hydrated 
    264      * with a subset of the columns in the resultset rows.  This is needed, for example, 
    265      * for results of JOIN queries where the resultset row includes columns from two or 
    266      * more tables. 
    267      * 
    268      * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. 
    269      * @param int $startcol 1-based offset column which indicates which restultset column to start with. 
    270      * @return int next starting column 
    271      * @throws PropelException  - Any caught Exception will be rewrapped as a PropelException. 
    272      */ 
     159    }  
     160     
    273161    public function hydrate(ResultSet $rs, $startcol = 1) 
    274162    { 
     
    289177            $this->setNew(false); 
    290178 
    291             // FIXME - using NUM_COLUMNS may be clearer. 
    292             return $startcol + 5; // 5 = QuestionTagPeer::NUM_COLUMNS - QuestionTagPeer::NUM_LAZY_LOAD_COLUMNS). 
    293  
     179                        return $startcol + 5;  
    294180        } catch (Exception $e) { 
    295181            throw new PropelException("Error populating QuestionTag object", $e); 
     
    297183    } 
    298184 
    299     /** 
    300      * Removes this object from datastore and sets delete attribute. 
    301      * 
    302      * @param Connection $con 
    303      * @return void 
    304      * @throws PropelException 
    305      * @see BaseObject::setDeleted() 
    306      * @see BaseObject::isDeleted() 
    307      */ 
     185     
    308186    public function delete($con = null) 
    309187    { 
     
    327205    } 
    328206 
    329     /** 
    330      * Stores the object in the database.  If the object is new, 
    331      * it inserts it; otherwise an update is performed.  This method 
    332      * wraps the doSave() worker method in a transaction. 
    333      * 
    334      * @param Connection $con 
    335      * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. 
    336      * @throws PropelException 
    337      * @see doSave() 
    338      */ 
     207     
    339208    public function save($con = null) 
    340209    { 
    341     if ($this->isNew()
     210    if ($this->isNew() && !$this->isColumnModified(QuestionTagPeer::CREATED_AT)
    342211    { 
    343212      $this->setCreatedAt(time()); 
     
    351220            $con = Propel::getConnection(QuestionTagPeer::DATABASE_NAME); 
    352221        } 
    353          
     222 
    354223        try { 
    355224            $con->begin(); 
     
    363232    } 
    364233 
    365     /** 
    366      * Stores the object in the database. 
    367      *  
    368      * If the object is new, it inserts it; otherwise an update is performed. 
    369      * All related objects are also updated in this method. 
    370      * 
    371      * @param Connection $con 
    372      * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. 
    373      * @throws PropelException 
    374      * @see save() 
    375      */ 
     234     
    376235    protected function doSave($con) 
    377236    { 
    378         $affectedRows = 0; // initialize var to track total num of affected rows     
    379         if (!$this->alreadyInSave) { 
     237        $affectedRows = 0;      if (!$this->alreadyInSave) { 
    380238            $this->alreadyInSave = true; 
    381239 
    382240 
    383             // We call the save method on the following object(s) if they 
    384             // were passed to this object by their coresponding set 
    385             // method.  This object relates to these object(s) by a 
    386             // foreign key reference. 
    387  
     241                                                 
    388242            if ($this->aQuestion !== null) { 
    389243                if ($this->aQuestion->isModified()) { 
     
    399253                $this->setUser($this->aUser); 
    400254            } 
    401      
    402  
    403             // If this object has been modified, then save it to the database. 
    404             if ($this->isModified()) { 
     255 
     256 
     257                        if ($this->isModified()) { 
    405258                if ($this->isNew()) { 
    406259                    $pk = QuestionTagPeer::doInsert($this, $con); 
    407                     $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which  
    408                                          // should always be true here (even though technically  
    409                                          // BasePeer::doInsert() can insert multiple rows). 
    410  
     260                    $affectedRows += 1;                                                                                   
    411261                    $this->setNew(false); 
    412262                } else { 
    413263                    $affectedRows += QuestionTagPeer::doUpdate($this, $con); 
    414264                } 
    415                 $this->resetModified(); // [HL] After being saved an object is no longer 'modified' 
    416             } 
     265                $this->resetModified();             } 
    417266 
    418267            $this->alreadyInSave = false; 
    419268        } 
    420269        return $affectedRows; 
    421     } // doSave() 
    422  
    423     /** 
    424      * Array of ValidationFailed objects. 
    425      * @var array ValidationFailed[] 
    426      */ 
     270    }  
     271     
    427272    protected $validationFailures = array(); 
    428273 
    429     /** 
    430      * Gets any ValidationFailed objects that resulted from last call to validate(). 
    431      * 
    432      * 
    433      * @return array ValidationFailed[] 
    434      * @see validate() 
    435      */ 
     274     
    436275    public function getValidationFailures() 
    437276    { 
     
    439278    } 
    440279 
    441     /** 
    442      * Validates the objects modified field values and all objects related to this table. 
    443      * 
    444      * If $columns is either a column name or an array of column names 
    445      * only those columns are validated. 
    446      * 
    447      * @param mixed $columns Column name or an array of column names. 
    448      * @return boolean Whether all columns pass validation. 
    449      * @see doValidate() 
    450      * @see getValidationFailures() 
    451      */ 
     280     
    452281    public function validate($columns = null) 
    453282    { 
     
    462291    } 
    463292 
    464     /** 
    465      * This function performs the validation work for complex object models. 
    466      * 
    467      * In addition to checking the current object, all related objects will 
    468      * also be validated.  If all pass then <code>true</code> is returned; otherwise 
    469      * an aggreagated array of ValidationFailed objects will be returned. 
    470      * 
    471      * @param array $columns Array of column names to validate. 
    472      * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. 
    473      */ 
     293     
    474294    protected function doValidate($columns = null) 
    475295    { 
     
    481301 
    482302 
    483             // We call the validate method on the following object(s) if they 
    484             // were passed to this object by their coresponding set 
    485             // method.  This object relates to these object(s) by a 
    486             // foreign key reference. 
    487  
     303                                                 
    488304            if ($this->aQuestion !== null) { 
    489305                if (!$this->aQuestion->validate($columns)) { 
     
    511327    } 
    512328 
    513     /** 
    514      * Retrieves a field from the object by name passed in as a string. 
    515      * 
    516      * @param string $name name 
    517      * @param string $type The type of fieldname the $name is of: 
    518      *                     one of the class type constants TYPE_PHPNAME, 
    519      *                     TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM 
    520      * @return mixed Value of field. 
    521      */ 
     329     
    522330    public function getByName($name, $type = BasePeer::TYPE_PHPNAME) 
    523331    { 
     
    526334    } 
    527335 
    528     /** 
    529      * Retrieves a field from the object by Position as specified in the xml schema. 
    530      * Zero-based. 
    531      * 
    532      * @param int $pos position in xml schema 
    533      * @return mixed Value of field at $pos 
    534      */ 
     336     
    535337    public function getByPosition($pos) 
    536338    { 
     
    554356                return null; 
    555357                break; 
    556         } // switch() 
    557     } 
    558  
    559     /** 
    560      * Exports the object as an array. 
    561      * 
    562      * You can specify the key type of the array by passing one of the class 
    563      * type constants. 
    564      * 
    565      * @param string $keyType One of the class type constants TYPE_PHPNAME, 
    566      *                        TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM 
    567      * @return an associative array containing the field names (as keys) and field values 
    568      */ 
     358        }   } 
     359 
     360     
    569361    public function toArray($keyType = BasePeer::TYPE_PHPNAME) 
    570362    { 
     
    580372    } 
    581373 
    582     /** 
    583      * Sets a field from the object by name passed in as a string. 
    584      * 
    585      * @param string $name peer name 
    586      * @param mixed $value field value 
    587      * @param string $type The type of fieldname the $name is of: 
    588      *                     one of the class type constants TYPE_PHPNAME, 
    589      *                     TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM 
    590      * @return void 
    591      */ 
     374     
    592375    public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) 
    593376    { 
     
    596379    } 
    597380 
    598     /** 
    599      * Sets a field from the object by Position as specified in the xml schema. 
    600      * Zero-based. 
    601      * 
    602      * @param int $pos position in xml schema 
    603      * @param mixed $value field value 
    604      * @return void 
    605      */ 
     381     
    606382    public function setByPosition($pos, $value) 
    607383    { 
     
    622398                $this->setNormalizedTag($value); 
    623399                break; 
    624         } // switch() 
    625     } 
    626  
    627     /** 
    628      * Populates the object using an array. 
    629      * 
    630      * This is particularly useful when populating an object from one of the 
    631      * request arrays (e.g. $_POST).  This method goes through the column 
    632      * names, checking to see whether a matching key exists in populated 
    633      * array. If so the setByName() method is called for that column. 
    634      * 
    635      * You can specify the key type of the array by additionally passing one 
    636      * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, 
    637      * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') 
    638      * 
    639      * @param array  $arr     An array to populate the object from. 
    640      * @param string $keyType The type of keys the array uses. 
    641      * @return void 
    642      */ 
     400        }   } 
     401 
     402     
    643403    public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) 
    644404    { 
     
    652412    } 
    653413 
    654     /** 
    655      * Build a Criteria object containing the values of all modified columns in this object. 
    656      * 
    657      * @return Criteria The Criteria object containing all modified values. 
    658      */ 
     414     
    659415    public function buildCriteria() 
    660416    { 
     
    670426    } 
    671427 
    672     /** 
    673      * Builds a Criteria object containing the primary key for this object. 
    674      * 
    675      * Unlike buildCriteria() this method includes the primary key values regardless 
    676      * of whether or not they have been modified. 
    677      * 
    678      * @return Criteria The Criteria object containing value(s) for primary key(s). 
    679      */ 
     428     
    680429    public function buildPkeyCriteria() 
    681430    { 
     
    689438    } 
    690439 
    691     /** 
    692      * Returns the composite primary key for this object. 
    693      * The array elements will be in same order as specified in XML. 
    694      * @return array 
    695      */ 
     440     
    696441    public function getPrimaryKey() 
    697442    { 
     
    707452    } 
    708453 
    709     /** 
    710      * Set the [composite] primary key. 
    711      * 
    712      * @param array $keys The elements of the composite key (order must match the order in XML file). 
    713      * @return void 
    714      */ 
     454     
    715455    public function setPrimaryKey($keys) 
    716456    { 
     
    724464    } 
    725465 
    726     /** 
    727      * Sets contents of passed object to values from current object. 
    728      *  
    729      * If desired, this method can also make copies of all associated (fkey referrers) 
    730      * objects. 
    731      * 
    732      * @param object $copyObj An object of QuestionTag (or compatible) type. 
    733      * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. 
    734      * @throws PropelException 
    735      */ 
     466     
    736467    public function copyInto($copyObj, $deepCopy = false) 
    737468    { 
     
    744475        $copyObj->setNew(true); 
    745476 
    746         $copyObj->setQuestionId(NULL); // this is a pkey column, so set to default value 
    747  
    748         $copyObj->setUserId(NULL); // this is a pkey column, so set to default value 
    749  
    750         $copyObj->setNormalizedTag(NULL); // this is a pkey column, so set to default value 
    751  
    752     } 
    753  
    754     /** 
    755      * Makes a copy of this object that will be inserted as a new row in table when saved. 
    756      * It creates a new object filling in the simple attributes, but skipping any primary 
    757      * keys that are defined for the table. 
    758      *  
    759      * If desired, this method can also make copies of all associated (fkey referrers) 
    760      * objects. 
    761      * 
    762      * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. 
    763      * @return QuestionTag Clone of current object. 
    764      * @throws PropelException 
    765      */ 
     477        $copyObj->setQuestionId(NULL);  
     478        $copyObj->setUserId(NULL);  
     479        $copyObj->setNormalizedTag(NULL);  
     480    } 
     481 
     482     
    766483    public function copy($deepCopy = false) 
    767484    { 
    768         // we use get_class(), because this might be a subclass 
    769         $clazz = get_class($this); 
     485                $clazz = get_class($this); 
    770486        $copyObj = new $clazz(); 
    771487        $this->copyInto($copyObj, $deepCopy); 
     
    773489    } 
    774490 
    775     /** 
    776      * Returns a peer instance associated with this om. 
    777      * 
    778      * Since Peer classes are not to have any instance attributes, this method returns the 
    779      * same instance for all member of this class. The method could therefore 
    780      * be static, but this would prevent one from overriding the behavior. 
    781      * 
    782      * @return QuestionTagPeer 
    783      */ 
     491     
    784492    public function getPeer() 
    785493    { 
     
    790498    } 
    791499 
    792     /** 
    793      * Declares an association between this object and a Question object. 
    794      * 
    795      * @param Question $v 
    796      * @return void 
    797      * @throws PropelException 
    798      */ 
     500     
    799501    public function setQuestion($v) 
    800502    { 
     
    812514 
    813515 
    814     /** 
    815      * Get the associated Question object 
    816      * 
    817      * @param Connection Optional Connection object. 
    818      * @return Question The associated Question object. 
    819      * @throws PropelException 
    820      */ 
     516     
    821517    public function getQuestion($con = null) 
    822518    { 
    823         // include the related Peer class 
    824         include_once 'model/om/BaseQuestionPeer.php'; 
     519                include_once 'lib/model/om/BaseQuestionPeer.php'; 
    825520 
    826521        if ($this->aQuestion === null && ($this->question_id !== null)) { 
    827522 
    828523            $this->aQuestion = QuestionPeer::retrieveByPK($this->question_id, $con); 
    829                      
    830             /* The following can be used instead of the line above to 
    831                guarantee the related object contains a reference 
    832                to this object, but this level of coupling 
    833                may be undesirable in many circumstances. 
    834                As it can lead to a db query with many results that may 
    835                never be used. 
    836                $obj = QuestionPeer::retrieveByPK($this->question_id, $con); 
    837                $obj->addQuestions($this); 
    838              */ 
     524 
     525             
    839526        } 
    840527        return $this->aQuestion; 
    841528    } 
    842529 
    843     /** 
    844      * Declares an association between this object and a User object. 
    845      * 
    846      * @param User $v 
    847      * @return void 
    848      * @throws PropelException 
    849      */ 
     530     
    850531    public function setUser($v) 
    851532    { 
     
    863544 
    864545 
    865     /** 
    866      * Get the associated User object 
    867      * 
    868      * @param Connection Optional Connection object. 
    869      * @return User The associated User object. 
    870      * @throws PropelException 
    871      */ 
     546     
    872547    public function getUser($con = null) 
    873548    { 
    874         // include the related Peer class 
    875         include_once 'model/om/BaseUserPeer.php'; 
     549                include_once 'lib/model/om/BaseUserPeer.php'; 
    876550 
    877551        if ($this->aUser === null && ($this->user_id !== null)) { 
    878552 
    879553            $this->aUser = UserPeer::retrieveByPK($this->user_id, $con); 
    880                      
    881             /* The following can be used instead of the line above to 
    882                guarantee the related object contains a reference 
    883                to this object, but this level of coupling 
    884                may be undesirable in many circumstances. 
    885                As it can lead to a db query with many results that may 
    886                never be used. 
    887                $obj = UserPeer::retrieveByPK($this->user_id, $con); 
    888                $obj->addUsers($this); 
    889              */ 
     554 
     555             
    890556        } 
    891557        return $this->aUser; 
    892558    } 
    893559 
    894 } // BaseQuestionTag 
     560}  
  • trunk/lib/model/om/BaseQuestionTagPeer.php

    r74 r88  
    11<?php 
    22 
    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 QuestionTagPeer::getOMClass() 
    6 include_once 'model/QuestionTag.php'; 
    7  
    8 /** 
    9  * Base static class for performing query and update operations on the 'ask_question_tag' table. 
    10  * 
    11  *  
    12  * 
    13  * @package model.om 
    14  */ 
     3 
    154abstract class BaseQuestionTagPeer { 
    165 
    17     /** the default database name for this class */ 
     6     
    187    const DATABASE_NAME = 'symfony'; 
    198 
    20     /** the table name for this class */ 
     9     
    2110    const TABLE_NAME = 'ask_question_tag'; 
    2211 
    23     /** A class that can be returned by this peer. */ 
    24     const CLASS_DEFAULT = 'model.QuestionTag'; 
    25  
    26     /** The total number of columns. */ 
     12     
     13    const CLASS_DEFAULT = 'lib.model.QuestionTag'; 
     14 
     15     
    2716    const NUM_COLUMNS = 5; 
    2817 
    29     /** The number of lazy-loaded columns. */ 
     18     
    3019    const NUM_LAZY_LOAD_COLUMNS = 0; 
    3120 
    3221 
    33     /** the column name for the QUESTION_ID field */ 
     22     
    3423    const QUESTION_ID = 'ask_question_tag.QUESTION_ID'; 
    3524 
    36     /** the column name for the USER_ID field */ 
     25     
    3726    const USER_ID = 'ask_question_tag.USER_ID'; 
    3827 
    39     /** the column name for the CREATED_AT field */ 
     28     
    4029    const CREATED_AT = 'ask_question_tag.CREATED_AT'; 
    4130 
    42     /** the column name for the TAG field */ 
     31     
    4332    const TAG = 'ask_question_tag.TAG'; 
    4433 
    45     /** the column name for the NORMALIZED_TAG field */ 
     34     
    4635    const NORMALIZED_TAG = 'ask_question_tag.NORMALIZED_TAG'; 
    4736 
    48     /** The PHP to DB Name Mapping */ 
     37     
    4938    private static $phpNameMap = null; 
    5039 
    5140 
    52     /** 
    53      * holds an array of fieldnames 
    54      * 
    55      * first dimension keys are the type constants 
    56      * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' 
    57      */ 
     41     
    5842    private static $fieldNames = array ( 
    5943        BasePeer::TYPE_PHPNAME => array ('QuestionId', 'UserId', 'CreatedAt', 'Tag', 'NormalizedTag', ), 
     
    6347    ); 
    6448 
    65     /** 
    66      * holds an array of keys for quick access to the fieldnames array 
    67      * 
    68      * first dimension keys are the type constants 
    69      * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 
    70      */ 
     49     
    7150    private static $fieldKeys = array ( 
    7251        BasePeer::TYPE_PHPNAME => array ('QuestionId' => 0, 'UserId' => 1, 'CreatedAt' => 2, 'Tag' => 3, 'NormalizedTag' => 4, ), 
     
    7655    ); 
    7756 
    78     /** 
    79      * @return MapBuilder the map builder for this peer 
    80      * @throws PropelException Any exceptions caught during processing will be 
    81      *       rethrown wrapped into a PropelException. 
    82      */ 
     57     
    8358    public static function getMapBuilder() 
    8459    { 
    85         include_once 'model/map/QuestionTagMapBuilder.php'; 
    86         return BasePeer::getMapBuilder('model.map.QuestionTagMapBuilder'); 
    87     } 
    88     /** 
    89      * Gets a map (hash) of PHP names to DB column names. 
    90      * 
    91      * @return array The PHP to DB name map for this peer 
    92      * @throws PropelException Any exceptions caught during processing will be 
    93      *       rethrown wrapped into a PropelException. 
    94      * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. 
    95      */ 
     60        include_once 'lib/model/map/QuestionTagMapBuilder.php'; 
     61        return BasePeer::getMapBuilder('lib.model.map.QuestionTagMapBuilder'); 
     62    } 
     63     
    9664    public static function getPhpNameMap() 
    9765    { 
     
    10775        return self::$phpNameMap; 
    10876    } 
    109     /** 
    110      * Translates a fieldname to another type 
    111      * 
    112      * @param string $name field name 
    113      * @param string $fromType One of the class type constants TYPE_PHPNAME, 
    114      *                         TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM 
    115      * @param string $toType   One of the class type constants 
    116      * @return string translated name of the field. 
    117      */ 
     77     
    11878    static public function translateFieldName($name, $fromType, $toType) 
    11979    { 
     
    12686    } 
    12787 
    128     /** 
    129      * Returns an array of of field names. 
    130      * 
    131      * @param  string $type The type of fieldnames to return: 
    132      *                      One of the class type constants TYPE_PHPNAME, 
    133      *                      TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM 
    134      * @return array A list of field names 
    135      */ 
     88     
    13689 
    13790    static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) 
     
    14396    } 
    14497 
    145     /** 
    146      * Convenience method which changes table.column to alias.column. 
    147      * 
    148      * Using this method you can maintain SQL abstraction while using column aliases. 
    149      * <code> 
    150      *      $c->addAlias("alias1", TablePeer::TABLE_NAME); 
    151      *      $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); 
    152      * </code> 
    153      * @param string $alias The alias for the current table. 
    154      * @param string $column The column name for current table. (i.e. QuestionTagPeer::COLUMN_NAME). 
    155      * @return string 
    156      */ 
     98     
    15799    public static function alias($alias, $column) 
    158100    { 
     
    160102    } 
    161103 
    162     /** 
    163      * Add all the columns needed to create a new object. 
    164      * 
    165      * Note: any columns that were marked with lazyLoad="true" in the 
    166      * XML schema will not be added to the select list and only loaded 
    167      * on demand. 
    168      * 
    169      * @param criteria object containing the columns to add. 
    170      * @throws PropelException Any exceptions caught during processing will be 
    171      *       rethrown wrapped into a PropelException. 
    172      */ 
     104     
    173105    public static function addSelectColumns(Criteria $criteria) 
    174106    { 
     
    189121    const COUNT_DISTINCT = 'COUNT(DISTINCT ask_question_tag.QUESTION_ID)'; 
    190122 
    191     /** 
    192      * Returns the number of rows matching criteria. 
    193      * 
    194      * @param Criteria $criteria 
    195      * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). 
    196      * @param Connection $con 
    197      * @return int Number of matching rows. 
    198      */ 
     123     
    199124    public static function doCount(Criteria $criteria, $distinct = false, $con = null) 
    200125    { 
    201         // we're going to modify criteria, so copy it first 
    202         $criteria = clone $criteria; 
    203  
    204         // clear out anything that might confuse the ORDER BY clause 
    205         $criteria->clearSelectColumns()->clearOrderByColumns(); 
     126                $criteria = clone $criteria; 
     127 
     128                $criteria->clearSelectColumns()->clearOrderByColumns(); 
    206129        if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { 
    207130            $criteria->addSelectColumn(QuestionTagPeer::COUNT_DISTINCT); 
     
    210133        } 
    211134 
    212         // just in case we're grouping: add those columns to the select statement 
    213         foreach($criteria->getGroupByColumns() as $column) 
     135                foreach($criteria->getGroupByColumns() as $column) 
    214136        { 
    215137            $criteria->addSelectColumn($column); 
     
    220142            return $rs->getInt(1); 
    221143        } else { 
    222             // no rows returned; we infer that means 0 matches. 
    223             return 0; 
    224         } 
    225     } 
    226     /** 
    227      * Method to select one object from the DB. 
    228      * 
    229      * @param Criteria $criteria object used to create the SELECT statement. 
    230      * @param Connection $con 
    231      * @return QuestionTag 
    232      * @throws PropelException Any exceptions caught during processing will be 
    233      *       rethrown wrapped into a PropelException. 
    234      */ 
     144                        return 0; 
     145        } 
     146    } 
     147     
    235148    public static function doSelectOne(Criteria $criteria, $con = null) 
    236149    { 
     
    243156        return null; 
    244157    } 
    245     /** 
    246      * Method to do selects. 
    247      * 
    248      * @param Criteria $criteria The Criteria object used to build the SELECT statement. 
    249      * @param Connection $con 
    250      * @return array Array of selected Objects 
    251      * @throws PropelException Any exceptions caught during processing will be 
    252      *       rethrown wrapped into a PropelException. 
    253      */ 
     158     
    254159    public static function doSelect(Criteria $criteria, $con = null) 
    255160    { 
    256161        return QuestionTagPeer::populateObjects(QuestionTagPeer::doSelectRS($criteria, $con)); 
    257162    } 
    258     /** 
    259      * Prepares the Criteria object and uses the parent doSelect() 
    260      * method to get a ResultSet. 
    261      * 
    262      * Use this method directly if you want to just get the resultset 
    263      * (instead of an array of objects). 
    264      * 
    265      * @param Criteria $criteria The Criteria object used to build the SELECT statement. 
    266      * @param Connection $con the connection to use 
    267      * @throws PropelException Any exceptions caught during processing will be 
    268      *       rethrown wrapped into a PropelException. 
    269      * @return ResultSet The resultset object with numerically-indexed fields. 
    270      * @see BasePeer::doSelect() 
    271      */ 
     163     
    272164    public static function doSelectRS(Criteria $criteria, $con = null) 
    273165    { 
     
    281173        } 
    282174 
    283         // Set the correct dbName 
    284         $criteria->setDbName(self::DATABASE_NAME); 
    285  
    286         // BasePeer returns a Creole ResultSet, set to return 
    287         // rows indexed numerically. 
    288         return BasePeer::doSelect($criteria, $con); 
    289     } 
    290     /** 
    291      * The returned array will contain objects of the default type or 
    292      * objects that inherit from the default. 
    293      * 
    294      * @throws PropelException Any exceptions caught during processing will be 
    295      *       rethrown wrapped into a PropelException. 
    296      */ 
     175                $criteria->setDbName(self::DATABASE_NAME); 
     176 
     177                        return BasePeer::doSelect($criteria, $con); 
     178    } 
     179     
    297180    public static function populateObjects(ResultSet $rs) 
    298181    { 
    299182        $results = array(); 
    300183     
    301         // set the class once to avoid overhead in the loop 
    302         $cls = QuestionTagPeer::getOMClass(); 
     184                $cls = QuestionTagPeer::getOMClass(); 
    303185        $cls = Propel: