Hiding column labels

I’m building a RESTful interface but I’m struggling to get the data in the correct format.

This is the query:




$query=$modelClass::find()

   ->select(['time','open','high','low','close','volume'])

   ->asArray()

   ->all();



The result, as expected is something like:




[

  {

    "time": "1970010100",

    "open": "100",

    "high": "105",

    "low": "98",

    "close": "102",

    "volume": "20000"

  },

  {

    "time": "1970010200",

    "open": "102",

    "high": "115",

    "low": "100",

    "close": "108",

    "volume": "12000"

  },

...

]



However, I have a frontend component that consumes data in this format:




[

  {

    "1970010100","100","105","98","102","20000"

  },

  {

    "1970010200","102","115","100","108","12000"

  },

...

]



Is there any way to accomplish this in Yii? I found a post on how to do it in SQL: http://stackoverflow.com/questions/16101495/how-can-i-suppress-column-header-output-for-a-single-sql-statement but I can figure out how to use mysql -N option in Yii (just for this query) or to set the column alias to ’ '. My last resource is to loop through the query to build a new array, but it doesn’t look right.

This is the code I’m using:




$query=$modelClass::find()

   ->select(['time','open','high','low','close','volume'])

   ->all();


//Is there any way to have the functionality below in the query above?

$result=[];

for($i=0;$i<count($query);$i++){

   $result[$i]=[

      $query[$i]->time,

      $query[$i]->open,

      $query[$i]->high,

      $query[$i]->low,

      $query[$i]->close,

      $query[$i]->volume

   ];

}

return $result;