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

(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?

"new_service" would be better then swapping the names.
Simpler is always better

Maybe the problem is the term singleton. It should probably be changed to Sheraton. Big Grin

Theme © iAndrew 2016 - Forum software by © MyBB