Development

Changeset 10549

You must first sign up to be able to contribute.

Changeset 10549

Show
Ignore:
Timestamp:
07/31/08 18:56:38 (4 months ago)
Author:
francois
Message:

sfPropelFinderPlugin Fixed problem with join() and with() when called by children of sfPropelPager (closes #4041)

Files:

Legend:

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

    r10546 r10549  
    613613=== 2008-07-31 | Trunk === 
    614614 
    615  * windock:  Fixed issue with `paginate()` when called by children of `sfPropelPager` 
     615 * francois: Fixed problem with `join()` and `with()` when called by children of `sfPropelPager` 
     616 * windock:  Fixed problem with `paginate()` when called by children of `sfPropelPager` 
    616617 * mrhyde:   Added `sfPropelFinder::groupByClass()` to ease PostgreSQL grouping 
    617618 * francois: Fixed problem with table alias and PostgreSQL (based on a patch by mrhyde) 
  • plugins/sfPropelFinderPlugin/lib/sfPropelFinder.php

    r10547 r10549  
    2727    if($class) 
    2828    { 
     29      // Instanciation with a class 
    2930      list($class, $alias) = $this->getClassAndAlias($class); 
    3031      $this->class = $class; 
    3132      $tmp = new $class; 
    3233      $this->setPeerClass(get_class($tmp->getPeer()), $alias); 
     34    } 
     35    else if($this->peerClass) 
     36    { 
     37      // Instanciation for a child of sfPropelFinder 
     38      $this->addRelation($this->peerClass); 
    3339    } 
    3440    if($this->peerClass) 
  • plugins/sfPropelFinderPlugin/test/unit/sfPropelFinderRelationsTest.php

    r10543 r10549  
    7979$con = Propel::getConnection(); 
    8080 
    81 $t = new lime_test(79, new lime_output_color()); 
     81$t = new lime_test(81, new lime_output_color()); 
    8282 
    8383$t->diag('findRelation()'); 
     
    468468$article = $finder->findOne(); 
    469469$t->is($finder->getLatestQuery(), 'SELECT article.ID, article.TITLE, article.CATEGORY_ID, COUNT(comment.ID) AS NbComments FROM article, comment WHERE article.ID=comment.ARTICLE_ID GROUP BY article.ID ORDER BY NbComments ASC LIMIT 1', 'Columns added with withColumn() can be used for sorting'); 
     470 
     471$t->diag('sfPropelFinder::with() issues with object finders classes'); 
     472class ArticleFinder extends sfPropelFinder 
     473{ 
     474  protected $peerClass = 'ArticlePeer'; 
     475} 
     476 
     477$finder = new ArticleFinder; 
     478try 
     479{ 
     480  $finder->join('Category')->find(); 
     481  $t->pass('Relations lookup work also on finder children objects'); 
     482} 
     483catch (Exception $e) 
     484{ 
     485  $t->fail('Relations lookup work also on finder children objects'); 
     486} 
     487try 
     488{ 
     489  $finder->with('Category')->find(); 
     490  $t->pass('Relations lookup work also on finder children objects'); 
     491} 
     492catch (Exception $e) 
     493{ 
     494  $t->fail('Relations lookup work also on finder children objects'); 
     495} 
     496