![]() |
Call multiple function in callback Models - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Call multiple function in callback Models (/showthread.php?tid=90864) |
Call multiple function in callback Models - warcooft - 05-14-2024 hello admin @kenjis, hello everyone, just wondering, is it possible to call multiple functions in a callback Models? for example: PHP Code: protected $afterInsert = ['saveJob1','saveJob2']; RE: Call multiple function in callback Models - ozornick - 05-14-2024 What happens if you try it? Also, the type is specified as an array RE: Call multiple function in callback Models - warcooft - 05-14-2024 when I tried it, it work properly. the problem is I couldn't access the $data passed in the saveJob2 function, and then I dumped it the contents is null. but in saveJob1 $data param can be accessed and processed see : https://imgur.com/a/fi7GwKX RE: Call multiple function in callback Models - ozornick - 05-15-2024 What did you do in the first event? If you have completed the request, most likely the data will be reset RE: Call multiple function in callback Models - warcooft - 05-15-2024 in the first event I only saved the data in tables that were related to the main table. See https://imgur.com/PUFlL52 RE: Call multiple function in callback Models - kenjis - 05-15-2024 Read https://codeigniter.com/user_guide/models/model.html#defining-callbacks RE: Call multiple function in callback Models - warcooft - 05-15-2024 (05-15-2024, 12:46 AM)kenjis Wrote: Read https://codeigniter.com/user_guide/models/model.html#defining-callbacks omg, i really never read this section before. Thanks @kenjis |