Welcome Guest, Not a member yet? Register   Sign In
Builder *and* beforeInert beforeUpdate
#1

I sorted out (with help of a post here) that the Builder functionality and the database model's use of beforeInsert and beforeUpdate don't work together.

I would like to extend the Model and write code for the builder (BaseBuilder) to insert the beforeInsert and beforeUpdate (might as well do the afters too, but whatever).
(side note: Would have been great if the builder functionality also worked with the Model settings, since, ya know, it seems like the protections from the builder and the functionality from the model together makes a good database interface, instead of picking one or the other and having to write the code to do what the other half would have done for you. Real missed opportunity here...)


I'm aware I need to put *something* in the autoloading section and all.

What I would like help with (unless someone else also found the Builder function lacking and has done this, then I need the webpage for their code) is what do I need to do to extend the Model and BaseBuilder core files (as in, what do I write and put where so I can just write the code and it will all work as expected without mucking up the main functions)

For the Model, I need to replace the builder function, so I will extend the class (https://codeigniter.com/user_guide/exten...re-classes) - where do I put this new Model class file in the App folder? How do I setup the autoloading files in the config to correctly see that file.

For the BaseBuilder, I need to update the update and insert functions, again extending the class. Do I just do the same thing as the Model (create the new file in the same place and do the same thing with the autoloading files)?

Thanks. Wish the docs where more helpful.
Reply


Messages In This Thread
Builder *and* beforeInert beforeUpdate - by Kaosweaver - 06-21-2022, 06:29 AM



Theme © iAndrew 2016 - Forum software by © MyBB