Changeset 10070
- Timestamp:
- 07/02/08 16:53:50 (2 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfPropelFinderPlugin/lib/sfPropelFinder.php
r10069 r10070 573 573 } 574 574 575 public function withI18n( )575 public function withI18n($culture = null) 576 576 { 577 577 $i18nClass = $this->class.'I18n'; 578 578 $tmp = new $i18nClass(); 579 579 $i18nPeerClass = get_class($tmp->getPeer()); 580 $culture = sfContext::getInstance()->getUser()->getCulture();580 if(is_null($culture)) $culture = sfContext::getInstance()->getUser()->getCulture(); 581 581 $this->addWithClass($this->class.'I18n'); 582 582 $this->criteria->add(constant($i18nPeerClass.'::CULTURE'), $culture); plugins/sfPropelFinderPlugin/test/unit/sfPropelFinderTest.php
r10068 r10070 65 65 ArticlePeer::doDeleteAll(); 66 66 67 $t = new lime_test(1 39, new lime_output_color());67 $t = new lime_test(140, new lime_output_color()); 68 68 69 69 $t->diag('find()'); … … 745 745 $t->is($article->getContent(), 'contenu français', 'withI18n() considers the current user culture for hydration'); 746 746 747 sfContext::getInstance()->getUser()->setCulture('fr'); 748 $article = sfPropelFinder::from('Article')-> 749 withI18n('en')-> 750 findOne(); 751 $t->is($article->getContent(), 'english content', 'withI18n() accepts a culture parameter to override the user culture'); 752 747 753 sfContext::getInstance()->getUser()->setCulture('en'); 748 754 $finder = sfPropelFinder::from('Article')->with('I18n'); … … 872 878 $t->is(sfPropelFinder::from('Article')->where('Title', 'updated title')->count(), 1, 'set() updates only the records found based on the array of values'); 873 879 874 875 880 try 876 881 {