如何在cakephp 3.2.7中使用saveMany

时间:2019-03-04 06:19:42

标签: cakephp cakephp-2.7 savemany

在cake 3.2.7安装上,saveMany()出现问题。它给出了错误Unknown method "saveMany"

$cartArrSave =     Array
    (
        [0] => Array
            (
                [deal_id] => 4
                [store_id] => 126
                [user_id] => 124
                [quantity] => 1
            )

        [1] => Array
            (
                [deal_id] => 9
                [store_id] => 127
                [user_id] => 124
                [quantity] => 1
            )

    )
    $this->Deals = TableRegistry::get('Deals');


    if(!empty($cartArrSave)){
        $this->Deals->newEntities($cartArrSave);  
        $this->Deals->saveMany($cartArrSave);  
    }

我已经检查了cakephp 2

是否支持saveMany

cakephp 3.x

也受其支持

那为什么会给出这样的错误?
请提出cakephp 2.7.8中的saveMany函数的替代方法吗?

0 个答案:

没有答案