MelodyMaker Posted April 16, 2008 Share Posted April 16, 2008 HI! I'm a bit confused about the associations between objects, so I would like to ask you about it, by using the following example: class DatabaseManager{ private function __construct(){} private function __clone(){} static public function getInstance(){ switch (Configuration::getInstance()->DBMS){ case "mysql": return MySqlDB::DBgetInstance(); break; default: return MySqlDB::DBgetInstance(); } } } Class Configuration{ private $DBconn = "localhost|myUser|myPwd|myDB"; private $sessionExpiration = 3600; private $DBMS = "mysql"; private static $confInstance; private function __construct(){} public static function getInstance(){ if (!self::$confInstance){ self::$confInstance = new Configuration(); } return self::$confInstance; } public function __GET($property){ if(isset($this->$property)){ return $this->$property; } return false; } private function __clone(){} } Class MysqlDB{ private $conf; public function __construct(){ $this->conf = Configuration::getInstance(); ... } ...bla bla } I just would like to know what kind of association ther is between I just would like to know what kind of association ther is between the configuration and the other two classes. I've just started to draw UML diagrams, and I'm getting mad about it... Thanks in advance! Davide Quote Link to comment https://forums.phpfreaks.com/topic/101389-association-aggregation-composition/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.