Development

Changeset 10779

You must first sign up to be able to contribute.

Changeset 10779

Show
Ignore:
Timestamp:
08/11/08 15:57:28 (3 months ago)
Author:
francois
Message:

sfPropelFinderPlugin [BC Break] Removed _and() (synonym for where()) and renamed _or() to orWhere(), Implemented sfDoctrineFinder::orWhere()

Files:

Legend:

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

    r10772 r10779  
    8181      where('PublishedAt', '<', time())-> 
    8282      find(); 
    83     // Or even better, use the _and() and _or() methods for SQL-like code 
     83    // For OR conditions, use orWhere() instead of where() 
    8484    $articles = $articleFinder-> 
    8585      where('Title', 'foo')-> 
    86       _and('PublishedAt', '<', time())-> 
    87         _or('Title', 'like', 'bar%')-> 
     86      where('PublishedAt', '<', time())-> 
     87      orWhere('Title', 'like', 'bar%')-> 
    8888      find(); 
    8989     
     
    116116 
    117117    // everything chained together 
    118     $articles = DbFinder::from('Article')->where('Title', 'like', '%world')->_and('IsPublished', true)->orderBy('CreatedAt')->find(); 
     118    $articles = DbFinder::from('Article')->where('Title', 'like', '%world')->where('IsPublished', true)->orderBy('CreatedAt')->find(); 
    119119    // You can write it in several lines, too 
    120120    $articles = DbFinder::from('Article')-> 
    121121      where('Title', 'like', '%world')-> 
    122       _and('IsPublished', true)-> 
     122      where('IsPublished', true)-> 
    123123      orderBy('CreatedAt')-> 
    124124      find(); 
     
    237237### Complex logic 
    238238 
    239     // _and() and _or() only allow simple logical operations on a single condition 
     239    // where() and _or() only allow simple logical operations on a single condition 
    240240    // For more complex logic, you have to use combine() 
    241241    // It expects an array of named conditions to be combined, and an operator 
     
    533533### 2008-08-11 | Trunk 
    534534 
     535* francois: Implemented `sfDoctrineFinder::orWhere()` 
     536* francois: [BC Break] Removed `_and()` (synonym for `where()`) and renamed `_or()` to `orWhere()` 
     537* mrhyde:   Fixed problem with `sfPropelFinder`, symfony cache, and Propel 1.3 
    535538* francois: Refactored `DbFinder` to allow agnostic finders on model objects to extend it, and to fix problem with lacking PHPDoc on `DbFinder` methods 
    536539* francois: Added abstract `sfModelFinder` class to keep all abstract methods out of `DbFinder` 
     
    558561### 2008-07-07 | 0.3.0 Beta 
    559562 
    560 * mrhyde:   Fixed problem with `sfPropelFinder`, symfony cache, and Propel 1.3 
    561563* francois: Added `sfPropelFinder::combine()` method to handle complex queries with And and Or 
    562564* francois: Added support for `with()` in `findPk()` (and documented the method) 
  • plugins/sfPropelFinderPlugin/lib/DbFinder.php

    r10765 r10779  
    523523   
    524524  /** 
    525    * Finder Fluid Interface for AND in a WHERE 
    526    * Infers $column, $value, $comparison from $columnName and some optional arguments 
    527    * 
    528    * @see     where() 
    529    * @return  DbDinder the current finder object 
    530    */ 
    531   public function _and() 
    532   { 
    533     call_user_func_array(array($this->adapter, '_and'), func_get_arg()); 
    534      
    535     return $this; 
    536   } 
    537    
    538   /** 
    539525   * Finder Fluid Interface for OR in a WHERE 
    540526   * Infers $column, $value, $comparison from $columnName and some optional arguments 
    541527   * Examples: 
    542    *   $articleFinder->_or('CommentId', 3) 
     528   *   $articleFinder->orWhere('CommentId', 3) 
    543529   *    => WHERE ... OR article.COMMENT_ID = 3 
    544    *   $articleFinder->_or('Title', 'like', '%foo') 
     530   *   $articleFinder->orWhere('Title', 'like', '%foo') 
    545531   *    => WHERE ... OR article.TITLE LIKE '%foo' 
    546532   * 
     
    551537   * @return     DbFinder the current finder object 
    552538   */ 
    553   public function _or() 
    554   { 
    555     call_user_func_array(array($this->adapter, '_or'), func_get_arg()); 
     539  public function orWhere() 
     540  { 
     541    call_user_func_array(array($this->adapter, 'orWhere'), func_get_arg()); 
    556542     
    557543    return $this; 
     
    735721      return call_user_func_array(array($this, 'where'), $arguments); 
    736722    } 
     723    if(strpos($name, 'orWhere') === 0) 
     724    { 
     725      array_unshift($arguments, substr($name, 7)); 
     726      return call_user_func_array(array($this, 'orWhere'), $arguments); 
     727    } 
    737728    if(strpos($name, 'orderBy') === 0) 
    738729    { 
     
    749740      array_unshift($arguments, substr($name, 4)); 
    750741      return call_user_func_array(array($this, 'join'), $arguments); 
    751  
    752742    } 
    753743    if(($pos = strpos($name, 'Join')) > 0) 
     
    757747      return call_user_func_array(array($this, 'join'), $arguments); 
    758748    } 
    759     if(strpos($name, '_and') === 0) 
    760     { 
    761       array_unshift($arguments, substr($name, 4)); 
    762       return call_user_func_array(array($this, '_and'), $arguments); 
    763     } 
    764     if(strpos($name, 'and') === 0) 
    765     { 
    766       array_unshift($arguments, substr($name, 3)); 
    767       return call_user_func_array(array($this, '_and'), $arguments); 
    768  
    769     } 
    770     if(strpos($name, '_or') === 0) 
    771     { 
    772       array_unshift($arguments, substr($name, 3)); 
    773       return call_user_func_array(array($this, '_or'), $arguments); 
    774  
    775     } 
    776     if(strpos($name, 'or') === 0) 
    777     { 
    778       array_unshift($arguments, substr($name, 2)); 
    779       return call_user_func_array(array($this, '_or'), $arguments); 
    780     } 
    781749    if(strpos($name, 'findBy') === 0) 
    782750    { 
  • plugins/sfPropelFinderPlugin/lib/sfDoctrineFinder.php

    r10765 r10779  
    1919    $reinit        = true, 
    2020    $query         = null, 
     21    $queryPattern  = '', 
     22    $queryArgs     = array(), 
     23    $argNumber     = 0, 
    2124    $queryListener = null, 
    2225    $withClasses   = array(), 
     
    6467  public function getQuery() 
    6568  { 
     69    return $this->buildQuery(); 
     70  } 
     71   
     72  public function buildquery() 
     73  { 
     74    if($this->queryPattern) 
     75    { 
     76      $this->query->addWhere($this->queryPattern, $this->queryArgs); 
     77      $this->queryPattern = ''; 
     78      $this->queryArgs = array(); 
     79    } 
     80     
    6681    return $this->query; 
    6782  } 
     
    279294  public function count($distinct = false) 
    280295  { 
    281     $res = $this->query->count(); 
     296    $res = $this->getQuery()->count(); 
    282297    $this->cleanup(); 
    283298     
     
    298313      $this->query->limit($limit); 
    299314    } 
    300     $res = $this->query->execute(); 
     315    $res = $this->getQuery()->execute(); 
    301316    $this->cleanup(); 
    302317     
     
    458473    if($forceIndividualDeletes) 
    459474    { 
    460       $objects = $this->query->delete()->execute(); 
     475      $objects = $this->getQuery()->delete()->execute(); 
    461476      $nbDeleted = 0; 
    462477      foreach($objects as $object) 
     
    468483    else 
    469484    { 
    470       if (!$this->query->contains('where')) 
     485      if (!$this->getQuery()->contains('where')) 
    471486      { 
    472487        // Empty queries don't return the number of deleted rows 
     
    674689  } 
    675690   
    676   protected function addCondition($column, $comparison, $value) 
    677   { 
     691  protected function addCondition($column, $comparison, $value, $operator = 'and') 
     692  { 
     693    if($comparison == ' NOT IN ') 
     694    { 
     695      throw new Exception('sfDoctrineFinder cannot add a condition with a NOT IN'); 
     696    } 
    678697    if($comparison == ' IN ') 
    679698    { 
     699      if($operator == 'or') 
     700      { 
     701        throw new Exception('sfDoctrineFinder cannot OR a condition with an IN'); 
     702      } 
    680703      $this->query->whereIn($column, $value); 
    681704    } 
    682705    else 
    683706    { 
     707      // The operator of the first condition is ignored 
     708      $operator = $this->queryPattern ? $operator : ''; 
    684709      if(is_null($value)) 
    685710      { 
    686         $this->query->addWhere(sprintf('%s %s', $column, $comparison)); 
     711        $this->queryPattern .= sprintf(' %s %s %s', $operator, $column, $comparison); 
    687712      } 
    688713      else 
    689714      { 
    690         $this->query->addWhere(sprintf('%s %s ?', $column, $comparison), is_array($value) ? $value : array($value)); 
    691       } 
    692     } 
    693   } 
    694  
    695   /** 
    696    * Infers $column, $value, $comparison from $columnName and some optional arguments 
    697    * 
    698    * @see     where() 
    699    * @return     sfDoctrineFinder the current finder object 
    700    */ 
    701   public function _and() 
    702   { 
    703     throw new Exception('This method is not yet implemented'); 
    704      
    705     return $this; 
     715        $argName = ':param'.$this->argNumber; 
     716        $this->argNumber++; 
     717        $this->queryPattern .= sprintf(' %s %s %s %s', $operator, $column, $comparison, $argName); 
     718        $this->queryArgs[$argName] = $value; 
     719      } 
     720    } 
    706721  } 
    707722 
     
    715730   * @return     sfDoctrineFinder the current finder object 
    716731   */ 
    717   public function _or() 
    718   { 
    719     throw new Exception('This method is not yet implemented'); 
     732  public function orWhere() 
     733  { 
     734    $arguments = func_get_args(); 
     735    $columnName = array_shift($arguments); 
     736    $column = $this->getColName($columnName); 
     737    list($value, $comparison) = self::getValueAndComparisonFromArguments($arguments); 
     738    $this->addCondition($column, $comparison, $value, 'or'); 
    720739     
    721740    return $this; 
     
    10011020      return call_user_func_array(array($this, 'where'), $arguments); 
    10021021    } 
     1022    if(strpos($name, 'orWhere') === 0) 
     1023    { 
     1024      array_unshift($arguments, substr($name, 7)); 
     1025      return call_user_func_array(array($this, 'orWhere'), $arguments); 
     1026    } 
    10031027    if(strpos($name, 'orderBy') === 0) 
    10041028    { 
     
    10151039      return call_user_func_array(array($this, 'join'), $arguments); 
    10161040    } 
    1017     if(strpos($name, '_and') === 0) 
    1018     { 
    1019       array_unshift($arguments, substr($name, 4)); 
    1020       return call_user_func_array(array($this, '_and'), $arguments); 
    1021     } 
    1022     if(strpos($name, 'and') === 0) 
    1023     { 
    1024       array_unshift($arguments, substr($name, 3)); 
    1025       return call_user_func_array(array($this, '_and'), $arguments); 
    1026  
    1027     } 
    1028     if(strpos($name, '_or') === 0) 
    1029     { 
    1030       array_unshift($arguments, substr($name, 3)); 
    1031       return call_user_func_array(array($this, '_or'), $arguments); 
    1032  
    1033     } 
    1034     if(strpos($name, 'or') === 0) 
    1035     { 
    1036       array_unshift($arguments, substr($name, 2)); 
    1037       return call_user_func_array(array($this, '_or'), $arguments); 
    1038     } 
    10391041    if(strpos($name, 'findBy') === 0) 
    10401042    { 
  • plugins/sfPropelFinderPlugin/lib/sfDoctrineFinderListener.php

    r10655 r10779  
    3434  public function preQuery(Doctrine_Event $event) 
    3535  { 
    36     $this->queries []= $event->getQuery().';'
     36    $this->queries []= $event->getQuery()
    3737  } 
    3838   
     
    4646  { 
    4747    $query = $event->getQuery(); 
    48     $query = strtr($query, array('?' => "'%s'")); 
    49     $this->queries []= vsprintf($query, $event->getParams()).';'; 
     48    $params = $event->getParams(); 
     49    foreach($params as $key => $value) 
     50    { 
     51      $params[$key] = "'".$value."'"; 
     52    } 
     53    $this->queries []= strtr($query, $params); 
    5054  } 
    5155   
  • plugins/sfPropelFinderPlugin/lib/sfModelFinder.php

    r10772 r10779  
    8181  abstract public function distinct(); 
    8282  abstract public function where(); 
    83   abstract public function _and(); 
    84   abstract public function _or(); 
     83  abstract public function orWhere(); 
    8584  abstract public function combine($conditions, $operator = 'and', $namedCondition = null); 
    8685  abstract public function relatedTo($object); 
  • plugins/sfPropelFinderPlugin/lib/sfPropelFinder.php

    r10765 r10779  
    964964 
    965965  /** 
    966    * Finder Fluid Interface for Criteria::addAnd() 
    967    * Infers $column, $value, $comparison from $columnName and some optional arguments 
    968    * 
    969    * @see     where() 
    970    * @return     sfPropelFinder the current finder object 
    971    */ 
    972   public function _and() 
    973   { 
    974     $arguments = func_get_args(); 
    975     $columnName = array_shift($arguments); 
    976     $column = $this->getColName($columnName); 
    977     list($value, $comparison) = self::getValueAndComparisonFromArguments($arguments); 
    978     $this->addCondition('And', $column, $value, $comparison); 
    979      
    980     return $this; 
    981   } 
    982  
    983   /** 
    984966   * Finder Fluid Interface for Criteria::addOr() 
    985967   * Infers $column, $value, $comparison from $columnName and some optional arguments 
    986968   * Examples: 
    987    *   $articleFinder->_or('CommentId', 3) 
     969   *   $articleFinder->orWhere('CommentId', 3) 
    988970   *    => $c->addOr(ArticlePeer::COMMENT_ID, 3) 
    989    *   $articleFinder->_or('Title', 'like', '%foo') 
     971   *   $articleFinder->orWhere('Title', 'like', '%foo') 
    990972   *    => $c->addOr(ArticlePeer::TITLE, '%foo', Criteria::LIKE) 
    991973   * 
     
    996978   * @return     sfPropelFinder the current finder object 
    997979   */ 
    998   public function _or() 
     980  public function orWhere() 
    999981  { 
    1000982    $arguments = func_get_args(); 
     
    10701052  /** 
    10711053   * We want that the Finder fuild Interface works like: 
    1072    *   PHP : whereA()->_andB->_orC()->_orD()->_andE() 
     1054   *   PHP : whereA()->whereB->orWhereC()->orWhereD()->whereE() 
    10731055   *   SQL : where A=? AND (B=? OR (C=? OR (D=? AND E=?))) 
    10741056   * So we have to add condition starting by the last one! 
     
    14891471      return call_user_func_array(array($this, 'where'), $arguments); 
    14901472    } 
     1473    if(strpos($name, 'orWhere') === 0) 
     1474    { 
     1475      array_unshift($arguments, substr($name, 7)); 
     1476      return call_user_func_array(array($this, 'orWhere'), $arguments); 
     1477    } 
    14911478    if(strpos($name, 'orderBy') === 0) 
    14921479    { 
     
    15031490      array_unshift($arguments, substr($name, 4)); 
    15041491      return call_user_func_array(array($this, 'join'), $arguments); 
    1505        
    15061492    } 
    15071493    if(($pos = strpos($name, 'Join')) > 0) 
     
    15111497      return call_user_func_array(array($this, 'join'), $arguments); 
    15121498    } 
    1513     if(strpos($name, '_and') === 0) 
    1514     { 
    1515       array_unshift($arguments, substr($name, 4)); 
    1516       return call_user_func_array(array($this, '_and'), $arguments); 
    1517     } 
    1518     if(strpos($name, 'and') === 0) 
    1519     { 
    1520       array_unshift($arguments, substr($name, 3)); 
    1521       return call_user_func_array(array($this, '_and'), $arguments); 
    1522  
    1523     } 
    1524     if(strpos($name, '_or') === 0) 
    1525     { 
    1526       array_unshift($arguments, substr($name, 3)); 
    1527       return call_user_func_array(array($this, '_or'), $arguments); 
    1528  
    1529     } 
    1530     if(strpos($name, 'or') === 0) 
    1531     { 
    1532       array_unshift($arguments, substr($name, 2)); 
    1533       return call_user_func_array(array($this, '_or'), $arguments); 
    1534     } 
    15351499    if(strpos($name, 'findBy') === 0) 
    15361500    { 
  • plugins/sfPropelFinderPlugin/test/unit/sfDoctrineFinderTest.php

    r10755 r10779  
    7373Doctrine_Query::create()->delete()->from('DArticle')->execute(); 
    7474 
    75 $t = new lime_test(77, new lime_output_color()); 
     75$t = new lime_test(84, new lime_output_color()); 
    7676 
    7777$t->diag('find()'); 
     
    476476$articles = sfDoctrineFinder::from('DArticle')->whereTitle('like', '%bc')->find(); 
    477477$t->is(count($articles), 2, 'whereXXX() accepts a comparator as first argument when two arguments are given'); 
     478 
     479$t->diag('orWhere()'); 
     480 
     481$columns    = "d.id AS d__id, d.title AS d__title, d.category_id AS d__category_id"; 
     482$baseSelect = "SELECT $columns FROM d_article d WHERE "; 
     483 
     484$finder = sfDoctrineFinder::from('DArticle')-> 
     485  where('Title', 'foo')-> 
     486  orWhere('Title', 'bar'); 
     487$finder->find(); 
     488$t->is( 
     489  $finder->getLatestQuery(), 
     490  $baseSelect . "(d.title = 'foo' OR d.title = 'bar')", 
     491  'orWhere() adds a SQL OR clause when called on a column where there is already a condition' 
     492); 
     493 
     494$finder = sfDoctrineFinder::from('DArticle')-> 
     495  where('Title', 'foo')-> 
     496  orWhere('CategoryId', 1); 
     497$finder->find(); 
     498$t->is( 
     499  $finder->getLatestQuery(), 
     500  $baseSelect . "(d.title = 'foo' OR d.category_id = '1')", 
     501  'orWhere() adds a SQL OR clause when called on a column where there is no condition yet' 
     502); 
     503 
     504$finder = sfDoctrineFinder::from('DArticle')-> 
     505  where('Title', 'foo')-> 
     506  where('Title', 'bar'); 
     507$finder->find(); 
     508$t->is( 
     509  $finder->getLatestQuery(), 
     510  $baseSelect . "(d.title = 'foo' AND d.title = 'bar')", 
     511  'where() adds a SQL AND clause when called on a column where there is already a condition' 
     512); 
     513 
     514$finder = sfDoctrineFinder::from('DArticle')-> 
     515  where('Title', 'foo')-> 
     516  where('CategoryId', 1); 
     517$finder->find(); 
     518$t->is( 
     519  $finder->getLatestQuery(), 
     520  $baseSelect . "(d.title = 'foo' AND d.category_id = '1')", 
     521  'where() adds a SQL AND clause when called on a column where there is no condition yet' 
     522); 
     523 
     524$finder = sfDoctrineFinder::from('DArticle')-> 
     525  where('CategoryId', 1)-> 
     526  where('Title', 'foo')-> 
     527  orWhere('Title', 'bar'); 
     528$finder->find(); 
     529$t->is( 
     530  $finder->getLatestQuery(), 
     531  $baseSelect . "(d.category_id = '1' AND (d.title = 'foo' OR d.title = 'bar'))", 
     532  'where() and orWhere() can be combined on the same finder' 
     533); 
     534 
     535/* 
     536$finder = sfDoctrineFinder::from('DArticle')-> 
     537  joinCategory()-> 
     538  where('Category.Name', 'foo')-> 
     539  orWhere('Category.Name', 'bar'); 
     540$finder->find(); 
     541$t->is( 
     542  $finder->getLatestQuery(), 
     543  "SELECT $columns FROM article, category WHERE (category.NAME='foo' OR category.NAME='bar') AND article.CATEGORY_ID=category.ID", 
     544  'orWhere() works on a simple jointure' 
     545); 
     546 
     547$finder = sfDoctrineFinder::from('DComment')-> 
     548  joinArticle()-> 
     549  joinAuthor()-> 
     550  where('Article.Title', 'foo')-> 
     551  orWhere('Author.Name', 'bar'); 
     552$finder->find(); 
     553$t->is( 
     554  $finder->getLatestQuery(), 
     555  "SELECT comment.ID, comment.CONTENT, comment.ARTICLE_ID, comment.AUTHOR_ID FROM comment, article, author WHERE (article.TITLE='foo' OR author.NAME='bar') AND comment.ARTICLE_ID=article.ID AND comment.AUTHOR_ID=author.ID", 
     556  'orWhere() works on a multiple jointure' 
     557); 
     558*/ 
     559 
     560$t->skip('orWhere() works on a simple jointure'); 
     561$t->skip('orWhere() works on a multiple jointure'); 
  • plugins/sfPropelFinderPlugin/test/unit/sfPropelFinderTest.php

    r10774 r10779  
    460460$t->is(count($articles), 2, 'whereXXX() accepts a comparator as first argument when two arguments are given'); 
    461461 
    462 $t->diag('_and() and _or()'); 
     462$t->diag('orWhere()'); 
    463463 
    464464$columns    = "article.ID, article.TITLE, article.CATEGORY_ID"; 
     
    467467$finder = sfPropelFinder::from('Article')-> 
    468468  where('Title', 'foo')-> 
    469   _or('Title', 'bar'); 
     469  orWhere('Title', 'bar'); 
    470470$finder->find(); 
    471471$t->is( 
    472472  $finder->getLatestQuery(), 
    473473  $baseSelect . "(article.TITLE='foo' OR article.TITLE='bar')", 
    474   '_or() adds a SQL OR clause when called on a column where there is already a condition' 
     474  'orWhere() adds a SQL OR clause when called on a column where there is already a condition' 
    475475); 
    476476 
    477477$finder = sfPropelFinder::from('Article')-> 
    478478  where('Title', 'foo')-> 
    479   _or('CategoryId', 1); 
     479  orWhere('CategoryId', 1); 
    480480$finder->find(); 
    481481$t->is( 
    482482  $finder->getLatestQuery(), 
    483483  $baseSelect . "(article.TITLE='foo' OR article.CATEGORY_ID=1)", 
    484   '_or() adds a SQL OR clause when called on a column where there is no condition yet' 
     484  'orWhere() adds a SQL OR clause when called on a column where there is no condition yet' 
    485485); 
    486486 
    487487$finder = sfPropelFinder::from('Article')-> 
    488488  where('Title', 'foo')-> 
    489   _and('Title', 'bar'); 
     489  where('Title', 'bar'); 
    490490$finder->find(); 
    491491$t->is( 
    492492  $finder->getLatestQuery(), 
    493493  $baseSelect . "(article.TITLE='foo' AND article.TITLE='bar')", 
    494   '_and() adds a SQL AND clause when called on a column where there is already a condition' 
     494  'where() adds a SQL AND clause when called on a column where there is already a condition' 
    495495); 
    496496 
    497497$finder = sfPropelFinder::from('Article')-> 
    498498  where('Title', 'foo')-> 
    499   _and('CategoryId', 1); 
     499  where('CategoryId', 1); 
    500500$finder->find(); 
    501501$t->is( 
    502502  $finder->getLatestQuery(), 
    503503  $baseSelect . "(article.TITLE='foo' AND article.CATEGORY_ID=1)", 
    504   '_and() adds a SQL AND clause when called on a column where there is no condition yet' 
     504  'where() adds a SQL AND clause when called on a column where there is no condition yet' 
    505505); 
    506506 
    507507$finder = sfPropelFinder::from('Article')-> 
    508508  where('CategoryId', 1)-> 
    509   _and('Title', 'foo')-> 
    510   _or('Title', 'bar'); 
     509  where('Title', 'foo')-> 
     510  orWhere('Title', 'bar'); 
    511511$finder->find(); 
    512512$t->is( 
    513513  $finder->getLatestQuery(), 
    514514  $baseSelect . "(article.CATEGORY_ID=1 AND (article.TITLE='foo' OR article.TITLE='bar'))", 
    515   '_and() and _or() can be combined on the same finder' 
     515  'where() and orWhere() can be combined on the same finder' 
    516516); 
    517517 
     
    519519  joinCategory()-> 
    520520  where('Category.Name', 'foo')-> 
    521   _or('Category.Name', 'bar'); 
     521  orWhere('Category.Name', 'bar'); 
    522522$finder->find(); 
    523523$t->is( 
    524524  $finder->getLatestQuery(), 
    525525  "SELECT $columns FROM article, category WHERE (category.NAME='foo' OR category.NAME='bar') AND article.CATEGORY_ID=category.ID", 
    526   '_or() works on a simple jointure' 
     526  'orWhere() works on a simple jointure' 
    527527); 
    528528 
     
    531531  joinAuthor()-> 
    532532  where('Article.Title', 'foo')-> 
    533   _or('Author.Name', 'bar'); 
     533  orWhere('Author.Name', 'bar'); 
    534534$finder->find(); 
    535535$t->is( 
    536536  $finder->getLatestQuery(), 
    537537  "SELECT comment.ID, comment.CONTENT, comment.ARTICLE_ID, comment.AUTHOR_ID FROM comment, article, author WHERE (article.TITLE='foo' OR author.NAME='bar') AND comment.ARTICLE_ID=article.ID AND comment.AUTHOR_ID=author.ID", 
    538   '_or() works on a multiple jointure' 
     538  'orWhere() works on a multiple jointure' 
    539539); 
    540540