Development

Changeset 8107

You must first sign up to be able to contribute.

Changeset 8107

Show
Ignore:
Timestamp:
03/27/08 08:57:29 (7 months ago)
Author:
francois
Message:

Fixed typos

Files:

Legend:

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

    r8102 r8107  
    8989}}} 
    9090 
     91=== Counting objects === 
     92 
     93{{{ 
     94#!php 
     95<?php 
     96// Counting all Articles 
     97$nbArticles = sfPropelFinder::from('Article')->count(); 
     98}}} 
     99 
    91100=== Combining methods === 
    92101 
     
    141150== Changelog == 
    142151 
     152=== 2008-03-27 | Trunk === 
     153 
     154 * francois: Added `sfPropelFinder::count()` method 
     155  
    143156=== 2008-03-27 | 0.1.0 alpha === 
    144157 
  • plugins/sfPropelFinderPlugin/lib/sfPropelFinder.php

    r8101 r8107  
    7676  } 
    7777   
    78   public function find($limit = null, $con = null, $reinitCriteria = true) 
     78  public function count($con = null, $reinitCriteria = true) 
     79  { 
     80    $ret = call_user_func(array($this->getPeerClass(), 'doCount'), $this->criteria, $con); 
     81    if($reinitCriteria) 
     82    { 
     83      $this->reinitCriteria(); 
     84    } 
     85     
     86    return $ret; 
     87     
     88  } 
     89   
     90  public function find($limit = null, $con = null, $reinitCriteria = false) 
    7991  { 
    8092    if($limit) 
  • plugins/sfPropelFinderPlugin/test/unit/sfPropelFinderTest.php

    r8101 r8107  
    8888 
    8989$t->diag('findPk()'); 
     90 
    9091$finder = new sfPropelFinder('Article'); 
    9192$article = $finder->findPk($article2->getId()); 
     
    100101$t->is(count($articles), 2, 'findPk() returns the objects with the primary keys matching the arguments'); 
    101102 
     103$t->diag('count()'); 
     104 
     105ArticlePeer::doDeleteAll(); 
     106$finder = new sfPropelFinder('Article'); 
     107$nbArticles = $finder->count(); 
     108$t->is_a_ok($nbArticles, 'integer', 'count() returns an integer'); 
     109$t->is($nbArticles, 0, 'count() returns 0 on empry tables'); 
     110 
    102111$t->diag('Instanciation possibilities'); 
    103112 
     113ArticlePeer::doDeleteAll(); 
     114$article = new Article(); 
     115$article->setTitle('foo'); 
     116$article->save(); 
    104117$finder = new sfPropelFinder('Article'); 
    105118$t->is($finder->getPeerClass(), 'ArticlePeer', 'PeerClass can be set during instanciation, in which case the finder is automatically initialized');