I know that using $dataMapperObject->query('INSERT INTO table (a,b) VALUES (1,2), (2,3), (3,4);'); will save multiple records as it's simple sql INSERT statement.
But how to store multiple values in same object of datamapper?
Example:
$addPatient= new Patient_table();
$addPatient->trans_begin();
foreach($_POST as $key=>$val){
$addPatient->patient_id=$this->patient-id;
$addPatient->question=$key;
$addPatient->answer=$val;
$addPatient->save();
}
Here in above example i want to store each and every question and answer successfully. If any of one is missing i wants to rallback entire transaction.
How to store all question answer in single object call?