开发者

Is it possible to fetch the names of the fields a table has, using Datamapper with Codeigniter?

I need to fetch the fields from a table so I can check if that particular table will accept a key/value pair. Is it possible to fetch only the field names? I'm using Datamapper with Codeigniter.开发者_运维知识库

EDIT:

Example:

//Controller
foreach($entity->allowedFields() as $key=>$value)
{
  $entity->$key = $value;
}

//Entity Model
function allowedFields()
{
  return $this->tableKeysAsArray;
}


Is it possible to fetch only the field names? As simple as

$o = new Foo();

foreach ($o->fields as $key, $field)
{
   echo 'Field ' . $key . ' is ' . $field .' <br>';
} 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜