1
属性是否有自动/动态设置为DataMapper的对象的所有属性,而不是赋予它们一个一个的方法吗?笨的DataMapper集对象从邮政数据
所以我的表单字段名称完全相同从DataMapper的模型的属性。
那么,有一个较短的方式做到这一点:
function add() {
if($this->input->post('client-add')) {
$c = new Client();
$c->name = $this->input->post('name');
$c->email = $this->input->post('email');
// and so on for about 20 more properties
$c->save();
}}
我结束了从笨DataMapper的安装阵列助手,结束了做$ C = from_array($这个 - >输入 - >后()); $ C-)>保存(; – Simon 2012-03-26 22:03:10