Models in CI4 |
Hi
I really need someone to give me a quick overview/ comparison of models in 3 <-> 4. I had absolutely no problem with the way models worked in 3, loved it in fact, but trying to work with the way models function now in CI4 seems to be an absolute nightmare. I know it's different and I just haven't got used to it yet, but is anyone able to give me some very basic examples of how to set a bunch of functions in a model file then call them when needed? so far I've managed to load a function with PHP Code: $db = \Config\Database::connect('default', false); but this errors (I think due to query building bit), and is an awful lot more work/ typing than the CI3 way of loading models and instantly being able to access all their functions. Am I doing something wrong? As for the query itself, this is the closest I can get to a simple query in CI4, but it still gives me errors. PHP Code: public function __construct(ConnectionInterface &$db) I am utterly confused at the CI4 way of using models if anyone can help. I am simply trying to echo out a row from the database so I know that it works before building upon that, but can't even get that working smoothly. |
Messages In This Thread |
Models in CI4 - by dudeawesome - 04-09-2020, 02:32 AM
RE: Models in CI4 - by includebeer - 04-10-2020, 04:51 AM
RE: Models in CI4 - by kilishan - 04-10-2020, 07:11 AM
|