Development

Changeset 9928

You must first sign up to be able to contribute.

Changeset 9928

Show
Ignore:
Timestamp:
06/27/08 15:35:44 (4 months ago)
Author:
francois
Message:

sfPropelFinderPlugin Made findLast() accept a column parameter

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfPropelFinderPlugin/lib/sfPropelFinder.php

    r9919 r9928  
    181181  } 
    182182   
    183   public function findLast($con = null, $reinitCriteria = true) 
    184   { 
    185     $this->guessOrder('desc'); 
     183  public function findLast($column = null, $con = null, $reinitCriteria = true) 
     184  { 
     185    if($column) 
     186    { 
     187      $this->orderBy($column, 'desc'); 
     188    } 
     189    else 
     190    { 
     191      $this->guessOrder('desc'); 
     192    } 
    186193     
    187194    return $this->findOne($con, $reinitCriteria); 
    188195  } 
    189196   
    190   public function findFirst($con = null, $reinitCriteria = true) 
    191   { 
    192     $this->guessOrder('asc'); 
     197  public function findFirst($column = null, $con = null, $reinitCriteria = true) 
     198  { 
     199    if($column) 
     200    { 
     201      $this->orderBy($column, 'asc'); 
     202    } 
     203    else 
     204    { 
     205      $this->guessOrder('asc'); 
     206    } 
    193207     
    194208    return $this->findOne($con, $reinitCriteria); 
     
    202216      $columnNames []= $c->getPhpName(); 
    203217    } 
    204     foreach(array('UpdatedAt', 'UpdatedOn', 'CreatedAt', 'CreatedOn', 'Id') as $testColumnName) 
     218    foreach(sfConfig::get('app_sfPropelFinder_sort_column_guesses', array('UpdatedAt', 'UpdatedOn', 'CreatedAt', 'CreatedOn', 'Id')) as $testColumnName) 
    205219    { 
    206220      if(in_array($testColumnName, $columnNames))