• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Always start a particular service...

#5
(09-29-2017, 04:49 PM)skunkbad Wrote:
(09-29-2017, 07:40 AM)Tripex Wrote: Is there a way to always start up a service without having to do it through your controller? (similar to the helpers variable but global).

I haven't found any straightforward way in the code out of the box.

1) Define "service".
2) Have you actually read the user guide (documentation)?
3) What the heck is a "helpers variable"?
4) It's pretty hard to do straightforward stuff when you can't describe what you're doing.
5) Stay in the box. If you don't know what you're doing and you venture outside the box, you'll be roaming in dangerous territory.

As for 1), 2) and 3)...
We are in the context of CI 4 and I assumed that when I say "service" that we are talking about CI services. The current intended way to start those seems to be in your controller by calling the corresponding service from Services.php E.g.

PHP Code:
$session = \Config\Services::session($config); 

In the system/Controller.php file there is a $helpers variable (class member) that takes an array of helpers you want to load with your controller... automatically. My question was if there was a way to start up your services automatically so that it is available in all your controllers without having to type it in for every controller... OR if there was an equivalent class member of Controller that could be used for services to at least have some consistency in how these things are started. I know I can inherit the class and do it myself but I really think this should be part of the framework.

I hope that makes it clearer.......

As for 4) and 5)
I know that you sometimes on forums like these can get a lot of newcomers that don't know what they are talking about or don't make sense... and I understand that it can be frustrating but these kind of comments from regulars (like you) here on the forums are NOT helping new people like me to get into the project.

I have both read the documentation and the source code and I'm getting familiar with the ins and outs of this project because I want to contribute. You really should think about how you approach people. I falsely assumed that it was understood what a "Service" was in the context of CI, I also assumed that it was known there was a $helpers class member (perhaps worded wrongly by saying "variable", but never mind) because it is in the documentation; it seems that this assumption was wrong and therefore it seemed like my question was incoherent, BUT it is offensive to practically be label incompetent by telling them to "Stay in the box". I would hope that you think about being more open to other new comers as to encourage people to contribute.
Reply


Messages In This Thread
Always start a particular service... - by Tripex - 09-29-2017, 07:40 AM
RE: Always start a particular service... - by Tripex - 10-02-2017, 12:49 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.