cakephp saveMany不保存表中的记录

时间:2015-08-12 15:15:27

标签: cakephp

这是我的代码

$users = array( 
                    array( 'username' => $this->request->data['Shop']['admin_username'],
                           'password' => $this->request->data['Shop']['admin_password'],
                           'role' => 'admin',
                           'shop_id' => $shop_id,
                           'active' => 1
                        ),
                    array( 'username' => $this->request->data['Shop']['manager_username'],
                           'password' => $this->request->data['Shop']['manager_password'],
                           'role' => 'manager',
                           'shop_id' => $shop_id,
                           'active' => 1
                        )

                );

                Debugger::dump($users); 

                //$this->User->create();
                $this->User->saveMany($users);

我正在尝试保存在数据库中重新编码的2。但它不起作用。我也尝试过saveAll,但我也没有工作。

1 个答案:

答案 0 :(得分:0)

$this->User->saveMany($users);返回什么?

您的用户模型中是否有任何验证规则?