public function compileMetadataForEntity($entity, $resource = null)
{
$this->managerMustExist();
$md = $this->manager->getMapper()->getEntityMetadata($entity);
$data = [Schema::TABLE_NAME => $md->getTableName(), Schema::COLUMNS => $this->compileColumns($md)];
if ($sortables = $this->compileSortIndices($md)) {
$data[Schema::SORT_INDICES] = $sortables;
}
if ($indices = $this->compileStdIndices($md)) {
$data[Schema::STD_INDICES] = $indices;
}
if ($resource) {
$this->sub_buffers[$resource] = [$md->getClassName() => $data];
} else {
$this->main_buffer[$md->getClassName()] = $data;
}
}