Development

Changeset 10664

You must first sign up to be able to contribute.

Changeset 10664

Show
Ignore:
Timestamp:
08/05/08 14:54:54 (4 months ago)
Author:
francois
Message:

sfPropelFinderPlugin Fixed issue when calling several termination methods on a finder (patch from mrhyde) (closes #4133)

Files:

Legend:

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

    r10655 r10664  
    612612== Changelog == 
    613613 
    614 === 2008-08-04 | Trunk === 
    615  
     614=== 2008-08-05 | Trunk === 
     615 
     616 * mrhyde:   Fixed issue when calling several termination methods on a finder 
    616617 * francois: Implemented `sfDoctrineFinder::count()` 
    617618 * francois: [BC Break] Replaced `sfPropelFinder::setPeerClass()` by `sfPropelFinder::setClass()` (will break classes extending sfPropelFinder) 
  • plugins/sfPropelFinderPlugin/lib/sfPropelFinder.php

    r10655 r10664  
    798798    $criteria = clone $this->criteria; 
    799799    $criterions = $this->criterions; 
    800  
     800    // Clone criterions to avoid repetition of conditions in a finder with several executions (like in a pager) 
     801    foreach ($criterions as &$criterion)  
     802    {  
     803      $criterion = clone $criterion; 
     804    } 
     805     
    801806    while ($criterion = array_pop($criterions)) 
    802807    { 
  • plugins/sfPropelFinderPlugin/test/unit/sfPropelFinderPagerTest.php

    r10655 r10664  
    5151ArticlePeer::doDeleteAll(); 
    5252 
    53 $t = new lime_test(30, new lime_output_color()); 
     53$t = new lime_test(31, new lime_output_color()); 
    5454 
    5555$article1 = new Article(); 
     
    152152  $t->fail('Children of sfPropelFinder can use paginate()'); 
    153153} 
     154 
     155$t->diag('sfPropelFinderPager issues with repeated criterions'); 
     156 
     157$finder = sfPropelFinder::from('Article')-> 
     158  where('Title', 'foo')-> 
     159  where('CategoryId', 1); 
     160$pager = $finder->paginate(2, 1); 
     161$results = $pager->getResults(); 
     162$t->is( 
     163  $finder->getLatestQuery(), 
     164  "SELECT article.ID, article.TITLE, article.CATEGORY_ID FROM article WHERE (article.TITLE='foo' AND article.CATEGORY_ID=1) LIMIT 1", 
     165  'getResults() does not repeat conditions' 
     166);