Changeset 49

Show
Ignore:
Timestamp:
05/24/08 14:04:33 (2 years ago)
Author:
nperriault
Message:

Resolved the context "default" does not exist bug by removing calls to sfContext in the model.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/apps/main/config/factories.yml

    r48 r49  
    4343      session_cookie_domain:   .<?php echo SYMFONIANS_MAIN_DOMAIN."\n" ?> 
    4444      session_cookie_lifetime: <?php echo (30 * 86400)."\n" ?>  
     45  user: 
     46    class:         myUser 
     47    param: 
     48      timeout:     <?php echo (30 * 86400)."\n" ?> 
  • trunk/apps/main/config/settings.yml

    r48 r49  
    44    no_script_name:         on 
    55    cache:                  on 
    6     timeout:                180000000 
    76 
    87dev: 
     
    1312    no_script_name:         off 
    1413    etag:                   off 
    15     timeout:                86400 
    1614 
    1715search: 
     
    2220    no_script_name:         off 
    2321    etag:                   off 
    24     timeout:                86400 
    2522 
    2623staging: 
     
    3128    no_script_name:         off 
    3229    etag:                   off 
    33     timeout:                86400 
    3430 
    3531test: 
  • trunk/lib/model/Application.php

    r48 r49  
    242242    $this->save(); 
    243243    $delete = parent::delete($con); 
    244     if ($this->getsfGuardUser()) 
    245     { 
    246       $this->getsfGuardUser()->updateKarma(true); 
    247     } 
    248244    return $delete; 
    249245  } 
     
    260256    $modified = $this->isModified(); 
    261257    $save = parent::save($con); 
    262  
    263     // Update user karma 
    264     if ($this->getsfGuardUser()) 
    265     { 
    266       $this->getsfGuardUser()->updateKarma(true); 
    267     } 
    268258 
    269259    // Create "app created" event object 
  • trunk/lib/model/ApplicationDeveloper.php

    r2 r49  
    88{ 
    99 
    10   public function delete($con = null) 
    11   { 
    12     $delete = parent::delete($con); 
    13     if ($this->getsfGuardUser()) 
    14     { 
    15       $this->getsfGuardUser()->updateKarma(true); 
    16     } 
    17     return $delete; 
    18   } 
    19    
    2010  public function save($con = null) 
    2111  { 
     
    2313    $modified = $this->isModified(); 
    2414    $save = parent::save($con); 
    25      
    26     if ($this->getsfGuardUser()) 
    27     { 
    28       $this->getsfGuardUser()->updateKarma(true); 
    29     } 
    3015     
    3116    // Create "person recommended" event object 
  • trunk/lib/model/Company.php

    r48 r49  
    182182 
    183183  /** 
    184    * Deletes Company instance 
    185    * 
    186    * @param  Connection $con 
    187    * @return int 
    188    */ 
    189   public function delete($con = null) 
    190   { 
    191     $delete = parent::delete($con); 
    192     if ($this->getsfGuardUser()) 
    193     { 
    194       $this->getsfGuardUser()->updateKarma(true); 
    195     } 
    196     return $delete; 
    197   } 
    198  
    199   /** 
    200184   * Saves Company instance 
    201185   * 
     
    208192    $modified = $this->isModified(); 
    209193    $affectedRows = parent::save($con); 
    210  
    211     if ($affectedRows > 0 && $this->getsfGuardUser()) 
    212     { 
    213       $this->getsfGuardUser()->updateKarma(true); 
    214     } 
    215194 
    216195    // Create "company created" event object 
  • trunk/lib/model/CompanyPerson.php

    r2 r49  
    1313    $modified = $this->isModified(); 
    1414    $save = parent::save($con); 
    15      
    16     if ($this->getsfGuardUser()) 
    17     { 
    18       $this->getsfGuardUser()->updateKarma(true); 
    19     } 
    2015     
    2116    // Create "person recommended" event object 
  • trunk/lib/model/Event.php

    r48 r49  
    129129    if (!$this->getType()) 
    130130    { 
    131       sfContext::getInstance()->getLogger()->err('No type specified for event'); 
     131      //sfContext::getInstance()->getLogger()->err('No type specified for event'); 
    132132      return 0; 
    133133    } 
     
    139139     
    140140    $this->setOccuredAt(time()); 
    141     $context = @sfContext::getInstance(); 
     141    /*$context = @sfContext::getInstance(); 
    142142    if (!is_null($context)) 
    143143    { 
     
    152152        } 
    153153      } 
    154     } 
     154    }*/ 
    155155    return parent::save($con); 
    156156  } 
  • trunk/lib/model/Job.php

    r48 r49  
    7373  } 
    7474   
    75   public function delete($con = null) 
    76   { 
    77     $delete = parent::delete($con); 
    78     if ($this->getsfGuardUser()) 
    79     { 
    80       $this->getsfGuardUser()->updateKarma(true); 
    81     } 
    82     return $delete; 
    83   } 
    84    
    8575  public function save($con = null) 
    8676  { 
     
    8979    $affectedRows = parent::save($con); 
    9080     
    91     if ($affectedRows > 0 && $this->getsfGuardUser()) 
    92     { 
    93       $this->getsfGuardUser()->updateKarma(true); 
    94     } 
    95      
    9681    if ($this->getCompanyId() && !$this->getCompany()->getAllowContact()) 
    9782    { 
    9883      $this->getCompany()->setAllowContact(true); 
    9984      $this->getCompany()->save(); 
    100       sfContext::getInstance()->getLogger()->info(sprintf('Company "%s" has now email contact enabled',  
    101                                             $this->getCompany()->getName())); 
     85      //sfContext::getInstance()->getLogger()->info(sprintf('Company "%s" has now email contact enabled',  
     86        //                                    $this->getCompany()->getName())); 
    10287    } 
    10388     
  • trunk/lib/model/PluginsfGuardUser.php

    r48 r49  
    700700 
    701701  /** 
    702    * Calculates new karma value and possibly saves the record 
    703    * 
    704    * @param boolean $save 
    705    * @param string $con 
    706    * @return mixed 
    707    */ 
    708   public function updateKarma($save = false, $con = null) 
    709   { 
    710     $karma_points = 0; 
    711  
    712     // Has an avatar 
    713     if ($this->getAvatarPath()) 
    714     { 
    715       $karma_points += sfConfig::get('app_karma_avatar'); 
    716     } 
    717  
    718     // Has an address 
    719     if ($this->hasAddress()) 
    720     { 
    721       $karma_points += sfConfig::get('app_karma_address'); 
    722     } 
    723  
    724     // Has a trac username 
    725     if ($this->getTracUsername()) 
    726     { 
    727       $karma_points += sfConfig::get('app_karma_trac_username'); 
    728     } 
    729  
    730     // Applications submitted 
    731     $app_submitted = $this->countApplications(); 
    732     if ($app_submitted > 0) 
    733     { 
    734       $karma_points += $app_submitted * sfConfig::get('app_karma_app_submitted'); 
    735     } 
    736  
    737     // Applications related 
    738     $app_related = $this->countApplicationDevelopers(); 
    739     if ($app_related > 0) 
    740     { 
    741       $karma_points += $app_related * sfConfig::get('app_karma_app_related'); 
    742     } 
    743  
    744     // Jobs submitted 
    745     $job_submitted = $this->countJobs(); 
    746     if ($job_submitted > 0) 
    747     { 
    748       $karma_points += $job_submitted * sfConfig::get('app_karma_job_submitted'); 
    749     } 
    750  
    751     // Companies submitted 
    752     $companies_submitted = $this->countCompanys(); 
    753     if ($companies_submitted > 0) 
    754     { 
    755       $karma_points += $companies_submitted * sfConfig::get('app_karma_companies_submitted'); 
    756     } 
    757  
    758     // Recommendations sent 
    759     $recommendations_sent = $this->countRecommendationsRelatedByRecommenderId(); 
    760     if ($recommendations_sent > 0) 
    761     { 
    762       $karma_points += $recommendations_sent * sfConfig::get('app_karma_recommendation_sent'); 
    763     } 
    764  
    765     // Recommendations received 
    766     $recommendations_received = $this->countRecommendationsRelatedByRecommendedId(); 
    767     if ($recommendations_received > 0) 
    768     { 
    769       $karma_points += $recommendations_received * sfConfig::get('app_karma_recommendation_get'); 
    770     } 
    771  
    772     parent::setKarma($karma_points); 
    773     sfContext::getInstance()->getLogger()->info(sprintf('karmadebug: %s\'s karma updated to %d', 
    774                                           $this->getUsername(), 
    775                                           $karma_points)); 
    776     $affectedRows = false; 
    777     if (true === $save) 
    778     { 
    779       $this->justKarma = true; 
    780       $affectedRows = $this->save($con); 
    781       $this->justKarma = false; 
    782     } 
    783     return $affectedRows; 
    784   } 
    785  
    786   /** 
    787702   * Saves current user record 
    788703   * 
  • trunk/lib/model/Recommendation.php

    r2 r49  
    88{ 
    99 
    10   public function delete($con = null) 
    11   { 
    12     $delete = parent::delete($con); 
    13     if ($this->getsfGuardUserRelatedByRecommenderId()) 
    14     { 
    15       $this->getsfGuardUserRelatedByRecommenderId()->updateKarma(true); 
    16     } 
    17     if ($this->getsfGuardUserRelatedByRecommendedId()) 
    18     { 
    19       $this->getsfGuardUserRelatedByRecommendedId()->updateKarma(true); 
    20     } 
    21     return $delete; 
    22   } 
    23  
     10  /** 
     11   * Retrieves recommended user 
     12   * 
     13   * @return sfGuardUser 
     14   */ 
    2415  public function getRecommended() 
    2516  { 
     
    2718  } 
    2819 
     20  /** 
     21   * Retrieves recommended user display name 
     22   * 
     23   * @return string 
     24   */ 
    2925  public function getRecommendedName() 
    3026  { 
     
    3228  } 
    3329 
     30  /** 
     31   * Retrieves recommender 
     32   * 
     33   * @return sfGuardUser 
     34   */ 
    3435  public function getRecommender() 
    3536  { 
     
    3738  } 
    3839 
     40  /** 
     41   * Retrieves recommender display name 
     42   * 
     43   * @return string 
     44   */ 
    3945  public function getRecommenderName() 
    4046  { 
     
    4248  } 
    4349 
     50  /** 
     51   * Saves object 
     52   * 
     53   * @return int 
     54   */ 
    4455  public function save($con = null) 
    4556  { 
     
    4758    $modified = $this->isModified(); 
    4859    $save = parent::save($con); 
    49  
    50     if ($this->getsfGuardUserRelatedByRecommenderId()) 
    51     { 
    52       $this->getsfGuardUserRelatedByRecommenderId()->updateKarma(true); 
    53     } 
    54  
    55     if ($this->getsfGuardUserRelatedByRecommendedId()) 
    56     { 
    57       $this->getsfGuardUserRelatedByRecommendedId()->updateKarma(true); 
    58     } 
    5960 
    6061    // Create "person recommended" event object