/**
* Builds an array of keyed on the fully-namespaced `Model` with array of fields as values
* for the given `Query`
*
* @param \lithium\data\model\Query $query A Query instance.
* @param \lithium\data\source\Result|null $resource An optional a result resource.
* @param object|null $context
* @return array
*/
public function schema($query, $resource = null, $context = null)
{
if (is_object($query)) {
$query->applyStrategy($this);
return $this->_schema($query, $this->_fields($query->fields(), $query));
}
$result = array();
if (!$resource || !$resource->resource()) {
return $result;
}
$count = $resource->resource()->columnCount();
for ($i = 0; $i < $count; $i++) {
$meta = $resource->resource()->getColumnMeta($i);
$result[] = $meta['name'];
}
return $result;
}