Jump to content

Messaging between objects


chadjohnson

Recommended Posts

Suppose we're using an object-oriented framework for our web site. We're obviously going to have a few common objects used throughout the framework, such as User and DB (or just a DB connection link). How would you go about making these objects available inside of the member functions of your classes? Would you encapsulate them some common object, like "Settings" or "Context"? Would you make these objects available inside member functions via "global $VARIABLE_NAME;"? Pass them individually or the Settings/Context object as a whole as a constructor parameter for every object in your framework?

 

Surely someone else has faced this problem before...

Link to comment
https://forums.phpfreaks.com/topic/87443-messaging-between-objects/
Share on other sites

I have a base class the all other class extends from directly or indirectly in my custom framework that hold instances of my database class, configuration class, url helper class, and anything else any class might need.  Oh, and all those classes use have singleton capability.

  • 4 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.