Development

Changeset 10546

You must first sign up to be able to contribute.

Changeset 10546

Show
Ignore:
Timestamp:
07/31/08 17:44:32 (4 months ago)
Author:
francois
Message:

sfPropelFinderPlugin Fixed issue with paginate() when called by children of sfPropelPager (based on a patch by windock) (closes #4040)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfPropelFinderPlugin/README

    r10545 r10546  
    613613=== 2008-07-31 | Trunk === 
    614614 
    615  * mrhyde: Added `sfPropelFinder::groupByClass()` to ease PostgreSQL grouping 
     615 * windock:  Fixed issue with `paginate()` when called by children of `sfPropelPager` 
     616 * mrhyde:   Added `sfPropelFinder::groupByClass()` to ease PostgreSQL grouping 
    616617 * francois: Fixed problem with table alias and PostgreSQL (based on a patch by mrhyde) 
    617  * mrhyde: Fixed problem with group by clauses being ripped off by pager 
     618 * mrhyde:   Fixed problem with group by clauses being ripped off by pager 
    618619 * francois: Implemented `DbFinder::toArray()`, `DbFinder::__toString()` and `DbFinder::toHtml()` 
    619620 * francois: Implemented `sfDoctrineFinder::findBy()`, `findOneBy()`, `findPk()`, and initialized `where()` 
     
    641642 * francois: Added `sfPropelFinder::findFirst()` and `sfPropelFinder::findLast()` methods 
    642643 * francois: Added `sfPropelFinder::withColumn()` method 
    643  * jug: Fixed problem in a particular join case 
     644 * jug:      Fixed problem in a particular join case 
    644645 * francois: Added `sfPropelFinder::with()` method (based on `sfPropelObjectPeerImpersonator::populateObjects()` code by hartym) 
    645646 * francois: Added support for magic `andXXX()` and `orXXX()` methods. 
    646  * jug: Fixed `_and()` and `_or()` so that they give expected results, rather than the buggy results of Propel's `addAnd()` and `addOr()` 
     647 * jug:      Fixed `_and()` and `_or()` so that they give expected results, rather than the buggy results of Propel's `addAnd()` and `addOr()` 
    647648 
    648649=== 2008-03-31 | 0.2.0 Beta === 
  • plugins/sfPropelFinderPlugin/lib/sfPropelFinder.php

    r10545 r10546  
    292292  public function paginate($page = 1, $maxPerPage = 10, $con = null) 
    293293  { 
    294     $pager = new sfPropelFinderPager($this->class, $maxPerPage); 
     294    // Children of sfPropelPager don't have a $class property, so we need to guess it 
     295    $class = isset($this->class) ? $this->class : sfPropelFinderUtils::getClassFromPeerClass($this->peerClass); 
     296    $pager = new sfPropelFinderPager($class, $maxPerPage); 
    295297    $pager->setFinder($this); 
    296298    $pager->setConnection($con); 
  • plugins/sfPropelFinderPlugin/test/unit/sfPropelFinderPagerTest.php

    r10542 r10546  
    5151ArticlePeer::doDeleteAll(); 
    5252 
    53 $t = new lime_test(29, new lime_output_color()); 
     53$t = new lime_test(30, new lime_output_color()); 
    5454 
    5555$article1 = new Article(); 
     
    136136$pager->getResults(); 
    137137$t->is($con->getLastExecutedQuery(), 'SELECT article.ID, article.TITLE, article.CATEGORY_ID FROM article GROUP BY article.TITLE LIMIT 2', 'sfPropelFinderPager::getResults() does not remove groupBy clauses and issues a elect()'); 
     138 
     139$t->diag('sfPropelFinderPager issues with object finders classes'); 
     140class ArticleFinder extends sfPropelFinder 
     141{ 
     142  protected $peerClass = 'ArticlePeer'; 
     143} 
     144$finder = new ArticleFinder(); 
     145try 
     146{ 
     147  $pager = $finder->paginate(); 
     148  $t->pass('Children of sfPropelFinder can use paginate()'); 
     149} 
     150catch(sfException $e) 
     151{ 
     152  $t->fail('Children of sfPropelFinder can use paginate()'); 
     153}