Pass multiple methods to $beforeInsert |
Maybe I didn't understand, but it's not possible to pass multiple methods to the $beforeInsertnel model variable, for example?
PHP Code: protected $beforeInsert = ['methods1', 'methods2']; If I pass only one method it works, if I pass 2 it returns me: Trying to access array offset on value of type null
No, it is possible to pass multiple methods.
You are doing something wrong.
(11-02-2022, 02:37 PM)kenjis Wrote: No, it is possible to pass multiple methods. I think so too, but what? PHP Code: protected $beforeInsert = ['methods1', 'methods2']; Keeping in mind that what is contained in method 2 is a small part that was previously contained by method 1, therefore functioning without problems, now I need to differentiate a given operation only to the insert and not also to the update, so not to repeat the same code twice seemed to me the best choice to have the insert execute method 1 and method 2, but only method 1 for the update. What's wrong with my code?
Try to remove `...some stuff`. You would see no errors.
After that, debug your code. |
Welcome Guest, Not a member yet? Register Sign In |