* unified and simplified Hydrate->fetchOne() as well as Table->find()
* both always return reliable false if result is empty
This commit is contained in:
parent
744666ab95
commit
814223bd39
@ -934,12 +934,13 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
|
||||
|
||||
$collection = $this->execute($params, $hydrationMode);
|
||||
|
||||
if (count($collection) === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch ($hydrationMode) {
|
||||
case Doctrine::HYDRATE_RECORD:
|
||||
if (count($collection) > 0) {
|
||||
return $collection->getFirst();
|
||||
}
|
||||
break;
|
||||
case Doctrine::HYDRATE_ARRAY:
|
||||
return array_shift($collection);
|
||||
}
|
||||
|
@ -879,15 +879,11 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
|
||||
switch ($hydrationMode) {
|
||||
case Doctrine::FETCH_RECORD:
|
||||
if (count($records) > 0) {
|
||||
return $records->getFirst();
|
||||
}
|
||||
case Doctrine::FETCH_ARRAY:
|
||||
if ( ! empty($records[0])) {
|
||||
return array_shift($records);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user