Changeset 5081

Show
Ignore:
Timestamp:
10/13/08 21:39:16 (9 months ago)
Author:
jwage
Message:

[1.0, 1.1] fixes #1548

Location:
branches
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/1.0/lib/Doctrine/Table.php

    r4957 r5081  
    13461346    protected function findOneBy($fieldName, $value, $hydrationMode = null) 
    13471347    { 
    1348         $results = $this->createQuery('dctrn_find') 
    1349                         ->where('dctrn_find.' . $fieldName . ' = ?',array($value)) 
    1350                         ->limit(1) 
    1351                         ->execute(array(), $hydrationMode); 
    1352  
    1353         if (is_array($results) && isset($results[0])) { 
    1354             return $results[0]; 
    1355         } else if ($results instanceof Doctrine_Collection && $results->count() > 0) { 
    1356             return $results->getFirst(); 
    1357         } else { 
    1358             return false; 
    1359         } 
     1348        return $this->createQuery('dctrn_find') 
     1349                    ->where('dctrn_find.' . $fieldName . ' = ?', array($value)) 
     1350                    ->limit(1) 
     1351                    ->fetchOne(array(), $hydrationMode); 
    13601352    } 
    13611353 
  • branches/1.1/lib/Doctrine/Table.php

    r5033 r5081  
    13991399    protected function findOneBy($fieldName, $value, $hydrationMode = null) 
    14001400    { 
    1401         $results = $this->createQuery('dctrn_find') 
    1402                         ->where('dctrn_find.' . $fieldName . ' = ?',array($value)) 
    1403                         ->limit(1) 
    1404                         ->execute(array(), $hydrationMode); 
    1405  
    1406         if (is_array($results) && isset($results[0])) { 
    1407             return $results[0]; 
    1408         } else if ($results instanceof Doctrine_Collection && $results->count() > 0) { 
    1409             return $results->getFirst(); 
    1410         } else { 
    1411             return false; 
    1412         } 
     1401        return $this->createQuery('dctrn_find') 
     1402                    ->where('dctrn_find.' . $fieldName . ' = ?', array($value)) 
     1403                    ->limit(1) 
     1404                    ->fetchOne(array(), $hydrationMode); 
    14131405    } 
    14141406