• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Combining $userModel->save() with Transactions


I have a pretty complex form that requires multiple table rows to be either inserted, updated or a combination of the two.

I was wondering if it is at all possible to use the $userModel->save() in conjunction with tranaction as this would be a very convenient way of updating my table without the need for a complex rollback function, something like? 

PHP Code:
protected $table      'mytable';
$primaryKey 'id';

$returnType 'array';
$allowedFields = [
public function 
addEditVals($vals) {
    $db db_connect();        
    foreach($vals as $valArray) {
    if ($this->db->transStatus() === FALSE) {
        log_message('notice''[ERROR] {file}-{line}, Failed to Add/Edit Table - '.session('user_name'));
        return false;
        log_message('notice''[SUCCESS] {file}-{line}, Table Added/Updated  - '.session('user_name'));
        return true;

Thanks in advance Smile

Messages In This Thread
Combining $userModel->save() with Transactions - by 68thorby68 - 09-24-2020, 07:30 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.