コード例 #1
0
 /**
  * Fetch and return the first column of all rows of the result set as an array
  *
  * @return  array
  */
 public function fetchColumn()
 {
     if (!$this->hasOrder()) {
         $this->order();
     }
     $results = $this->query->fetchColumn();
     if (!empty($results) && $this->repository->providesValueConversion($this->target)) {
         $columns = $this->getColumns();
         $aliases = array_keys($columns);
         $column = is_int($aliases[0]) ? $columns[0] : $aliases[0];
         if ($this->repository->providesValueConversion($this->target, $column)) {
             foreach ($results as &$value) {
                 $value = $this->repository->retrieveColumn($this->target, $column, $value, $this);
             }
         }
     }
     return $results;
 }