Reputation: 142
i have array with valid and not valid values , i want to save valid values with saveMany method , but if this method validate all value in array its work and save my data Otherwise its not working !
my array :
array(
(int) 0 => array(
'product_id' => '3',
'factor_id' => '2',
),
(int) 1 => array(
'product_id' => '1',
'factor_id' => '2',
)
)
my code :
$this->Basket->saveMany($newBasket);
//or
$this->Basket->saveMany($newBasket,array('validate' => true));
thanks
Upvotes: 1
Views: 1023
Reputation: 142
my answer is :
$this->ModelName->saveMany($data,array('validate'=>'only','atomic'=>false));
thanks all
Upvotes: 2