Welcome Guest, Not a member yet? Register   Sign In
How do I have a global array in __construct() ?

(This post was last modified: 08-07-2017, 04:26 PM by jarmen_kell.)

(08-07-2017, 01:05 PM)desbest Wrote: I found a good tutorial on object orientated programming on envato net tuts which explains how to do it with more OOP concept.s

The thing with programming is that there is so much that one could possibly know about it, that one cannot learn it all, so I only learn the stuff that I am required to know.  Wink

I like to write database queries in the controller. I believe in following DRY. Don't Repeat Yourself. So I don't see the point of moving the database queries to the model if the code for the queries are only going to be used once in the code. It's not like I'm using the same block of code repeatedly.

Thank you for your help.

The fact that you don't even know how to set a public variable inside a class to be accessible by related objects,
indicates that you still doesn't know THE VERY BASIC of oop.
or, that "good tutorial" you're using as learning resource doesn't provide a good basic practice of oop.
or, you're the kind of person that likes to skim an article of tutorial, skipping important parts,
and brags that "i already learned the article, and its good".

writing queries inside controllers is... i asure you... a very-very bad practice.
your so-called 'DRY' isn't just talking about repeating the same-exact things over and over.
it's also a practice of how to better organize your source between app-logic and db-models in your app.

so I'm gonna agree with everyone else here,
STOP DOING WHAT YOU'RE DOING... and right now.

Messages In This Thread
RE: How do I have a global array in __construct() ? - by jarmen_kell - 08-07-2017, 04:23 PM

Theme © iAndrew 2016 - Forum software by © MyBB