Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constructor in CI4 #1300

Closed
tpw1314 opened this issue Dec 16, 2018 · 6 comments
Closed

Constructor in CI4 #1300

tpw1314 opened this issue Dec 16, 2018 · 6 comments

Comments

@tpw1314
Copy link
Contributor

tpw1314 commented Dec 16, 2018

This Github Issue section is meant to track bugs with the library itself
Please post generic support issues to the CodeIgniter forums or StackOverflow.

Hi, I should include @bvrignaud in this discussion as well.

They don’t use a constructor any more (to invoke CI “magic”) unless that is part of a base controller you make

I saw a constructor function in IonAuth controller. As CI4 suppose to work its magic, is this constructor necessary ?

@bvrignaud
Copy link
Contributor

Yes it is, it loads everything the controller needs: libraries, helpers, models, ...

@tpw1314
Copy link
Contributor Author

tpw1314 commented Dec 16, 2018

I see. Is there no way to use CI4's magic way to load all the libraries/components that it needs ? I don't really understand how CI4 magic works if constructor is still needed. I tried CI4 documentation but there isn't really a detailed explanation.

@bvrignaud
Copy link
Contributor

Can you send here the "CI4's magic" documentation url please.
I don't understand what you're talking about.

What's the problem with using constructor in controllers ?

@tpw1314
Copy link
Contributor Author

tpw1314 commented Dec 17, 2018

Can you send here the "CI4's magic" documentation url please.
I don't understand what you're talking about.

What's the problem with using constructor in controllers ?

Here you go. I am actually in doubt. The problem is that there is no proper explanation as of why not and what is the difference/impact.
LINK

@bvrignaud
Copy link
Contributor

I seen.

They don’t use a constructor any more (to invoke CI “magic”) unless that is part of a base controller you make

As the doc explain, CodeIgniter controller doesn't use any more construct to load "magically" libraries, ... but that does not mean that we can not use them.
And, in fact, we use them to load necessary data.

@benedmunds
Copy link
Owner

Closing due to inactivity.

@tpw1314 please comment here and tag me if you'd like to discuss further. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants