Development

Changeset 10167

You must first sign up to be able to contribute.

Changeset 10167

Show
Ignore:
Timestamp:
07/07/08 15:55:31 (5 months ago)
Author:
francois
Message:

sfPropelFinderPlugin Fixed a problem when looking for a relationship (closes #3916)

Files:

Legend:

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

    r10166 r10167  
    10591059          $mapBuilder->doBuild(); 
    10601060        } 
    1061         if($this->databaseMap->getTable($c->getRelatedTableName())->getPhpName() == $phpName) 
     1061        try 
     1062        { 
     1063          $tableMap = $this->databaseMap->getTable($c->getRelatedTableName()); 
     1064        } 
     1065        catch (PropelException $e) 
     1066        { 
     1067          // so $c->getRelatedTable() is not in the database map 
     1068          // even though the $phpName table map has been initialized 
     1069          // we are obviously looking for the wrong table here 
     1070          continue; 
     1071        } 
     1072        if($tableMap->getPhpName() == $phpName) 
    10621073        { 
    10631074          return array( 
     
    10661077          ); 
    10671078        } 
     1079 
    10681080      } 
    10691081    } 
  • plugins/sfPropelFinderPlugin/test/unit/sfPropelFinderRelationsTest.php

    r10133 r10167  
    7979$con = Propel::getConnection(); 
    8080 
    81 $t = new lime_test(77, new lime_output_color()); 
     81$t = new lime_test(78, new lime_output_color()); 
    8282 
    8383$t->diag('findRelation()'); 
     84 
     85class myFinder extends sfPropelFinder 
     86{ 
     87  public function findRelation($arg1, $arg2) 
     88  { 
     89    return parent::findRelation($arg1, $arg2); 
     90  } 
     91} 
     92$finder = new myFinder('Article'); 
     93try 
     94{ 
     95  $relation = $finder->findRelation('ArticleI18n', 'ArticlePeer'); 
     96  $t->pass('findRelation() does not fail to find relationships when the whole database map is not built yet'); 
     97} 
     98catch(Exception $e) 
     99{ 
     100  $t->fail('findRelation() does not fail to find relationships when the whole database map is not built yet'); 
     101} 
     102 
    84103 
    85104ClubPeer::doDeleteAll();