1
0No answers
Browser other questions tagged codeigniter codeigniter-3
You are not signed in. Login or sign up in order to post.1
Browser other questions tagged codeigniter codeigniter-3
You are not signed in. Login or sign up in order to post.
It is not necessarily wrong/right, but the ideal is that each method (Function) had a unique responsibility, your save() does both the Sert and the update, it would be nice if they were separated, to facilitate even its maintenance
– Thiago
I understood but what would be the difficulty of maintaining in this case since the same function would be changed in only one place ? sorry I’m still learning php and good practices and would like to know in depth how it works
– Fábio Silva
The idea is that: if you need to change the behavior/rules or validations when entering (Insert), you just need to change your Insert() method, and you don’t need to be doing multiple ifs inside save(), as your application grows the trend is that it happens, not that this will necessarily happen in this system you are working on now, but it would be ideal
– Thiago
thanks this helped to understand better, how it works
– Fábio Silva