Welcome Guest, Not a member yet? Register   Sign In
Multiple Class Instances vs Function Call
#2

In CI4, you can use the model() function to get (or create) a shared instance of a model class.

If you benchmark Method 1 vs Method 2, there's probably not much in it and any difference probably won't be the main bottleneck in your application anyway.

One benefit of using Method 2 with functions for each one is that it is a good place to cache the results, eliminating the need to load the models, data from the database and whatever logic happens in displayInvoices().
Reply


Messages In This Thread
RE: Multiple Class Instances vs Function Call - by craig - 11-27-2020, 10:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB