| 1: | <?php |
| 2: | namespace TIC\DormBundle\Hydration; |
| 3: | |
| 4: | use Doctrine\ORM\Internal\Hydration\AbstractHydrator; |
| 5: | |
| 6: | /** |
| 7: | * Récupération de toutes les valeurs de la 1ère colonne. |
| 8: | * |
| 9: | * Exemple: |
| 10: | * > SELECT a, b, c FROM t |
| 11: | * < array(a1, a2, a3 ...) |
| 12: | */ |
| 13: | class ColumnHydrator extends AbstractHydrator |
| 14: | { |
| 15: | |
| 16: | /** |
| 17: | * Hydrates all rows from the current statement instance at once. |
| 18: | * |
| 19: | * @return mixed[] |
| 20: | */ |
| 21: | protected function hydrateAllData(): array |
| 22: | { |
| 23: | # return $this->statement()->fetchAll(\PDO::FETCH_COLUMN, 0); |
| 24: | return $this->statement()->fetchFirstColumn(); |
| 25: | } |
| 26: | |
| 27: | } |
| 28: |