Created
December 14, 2010 10:05
-
-
Save sobstel/740225 to your computer and use it in GitHub Desktop.
Doctrine_Hydrator_FlatArray
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Doctrine::HYDRATE_SCALAR without component alias at the beginning. | |
* For key names it takes columns and aliases from SELECT statement. | |
* First column/alias from statement is used as key for whole row. | |
*/ | |
class Doctrine_Hydrator_FlatArray extends Doctrine_Hydrator_ScalarDriver { | |
public function hydrateResultSet($stmt) | |
{ | |
$cache = array(); | |
$result = array(); | |
while ($data = $stmt->fetch(Doctrine_Core::FETCH_ASSOC)) { | |
$row = $this->_gatherRowData($data, $cache, false); | |
$result[current($row)] = $row; | |
} | |
return $result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment