lithium\data\source\Database::schema()
Builds an array of keyed on the fully-namespaced Model
with array of fields as values
for the given Query
Parameters
-
\lithium\data\model\Query
$query
A Query instance.
-
\lithium\data\source\Result|null
$resource
An optional a result resource.
-
object|null
$context
Returns
arraySource
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;
}