Welcome Guest, Not a member yet? Register   Sign In
Is the single_service function mis-named?
#1

(This post was last modified: 12-28-2018, 10:25 PM by AvalonSys.)

There may be a confusing naming issue between the service() and single_service() functions.

If I'm reading the docs right (at: https://codeigniter4.github.io/userguide...-functions), the service() function effectively returns a singleton ("shared") object,  while the single_service() function, somewhat counter-intuitively, returns a new object. 

Does anyone else find this confusing and kinda backwards? 

Assuming I've read the docs correctly, it would make more sense to me to change "single_service()" to "new_service()" or something that makes it clear that you're NOT getting a singleton object from the function. Either that, or maybe swap the function names around?
Reply


Messages In This Thread
Is the single_service function mis-named? - by AvalonSys - 12-28-2018, 03:52 PM



Theme © iAndrew 2016 - Forum software by © MyBB