⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Problem with callbackAfterInsert



oak
  • profile picture
  • Member

Posted 26 March 2019 - 15:28 PM

Hello,

 

this is my function..

 

// generate keyid
$crud->callbackAfterInsert(
    function ($stateParameters) {      
    $crud->where('pid', $stateParameters->insertId);
    $project = $crud->get('projects')->row();    
    $keyid = substr(str_shuffle(MD5(microtime())), 0, 18);
    if (!empty($keyid)) {
      $crud->update('projects', ['keyid' => $keyid]);
    }
    return $stateParameters;
});

 

Always gives error: <b>Fatal error</b>:  Call to a member function where() on null in

 

But i dont understand... can someone help please?


oak
  • profile picture
  • Member

Posted 26 March 2019 - 16:08 PM

Hello someone there? I only need this small hint.

 

This row makes problems:

$crud->where('pid', $stateParameters->insertId);

 

i also tested

$this->db->where('pid', $stateParameters->insertId); (Error Using $this when not in object context)


website4you
  • profile picture
  • Member

Posted 24 April 2019 - 17:33 PM

 

i also tested

$this->db->where('pid', $stateParameters->insertId); (Error Using $this when not in object context)

Having the same issue, asked about it here on the forum but no reply from author or other members.  :huh: