Hi Team,
i found a bug with callback_insert. What happens here ... as per example in the documentation, if we follow, it is as expected - we are supposed to return the last insert id ... this is useful for us to edit the same record if required. But what i noticed in here was - when we do the same, the id is not taken / updated in for the row / record. This is causing it to mark the edit url to edit/1 ... and not the returned row id..
Below is the actual scenario and a proposed solution over the same.
//Actual scenario $callback_return = call_user_func($this->callback_insert, $post_data); if($callback_return === false) { return false; } //Proposed scenario $callback_return = call_user_func($this->callback_insert, $post_data); if($callback_return === false) { return false; } else { $insert_primary_key = $callback_return; }
There was 1 more issue noticed .. when we set callback_insert(array($this), 'function_name') - this is accepted by the GC library... and it tries to make a call to a function that is not set..
I was thinking of a updating the code to check and give the error prior to execution .. like user has to set the callback function
i know this is a feasible type.. where user can just set the single string of the function name that can reside in other helper file . but we can enhance the code to check ...
if the 1st value set is instance of class or an object, we should strictly require the second element of the array to be present.
This way, we can ensure that the library is much much stronger then.
THANK YOU FOR SUCH A WONDERFUL LIBRARY