Re: OOP Application Architecture

From: Date: Thu, 08 Dec 2011 13:28:55 +0000
Subject: Re: OOP Application Architecture
References: 1  Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-12608@lists.php.net to get a copy of this message
Hi. This ist is for discussing and maintaining the php.net web infrastructure. For general PHP support questions, see "General Mailing Lists"* or the support page**. * http://php.net/mailing-lists.php ** http://www.php.net/support.php On Thu, Dec 8, 2011 at 10:55 AM, Dominik Halvoník < dominik.halvonik@gmail.com> wrote: > Hello, > > I would like to ask you for help. This days I am trying to build one of my > applications. But I have problem which stopped me. I have folder whit php > files like connect.php, delete.php etc. These files contains classes named > the same as files. So in file connect.php is class Connect. These files are > placed in folder named *mysql* and this folder is inside folder named *db.. > In folder db is a php file named mysql.php, in this file I include classes > from folder mysql, after include I declare class MySQL and in it I have > method __construct(). In this method I create dynamic objects from included > classes. And this is the problem that I can not solve, I have more then one > of this files(mysql.php[whit class MySQL], oracle.php[whit class Oracle] > etc.) and I need to include them to file called db.php that is in the main > folder of my app. In db.php is an class called db, how can I add classes > MySQL, Oracle etc. to class db? I try to use abstract class whit __set and > __get methods but I also need to include class db to main class > application. I am really sorry for my English, so please be indulgent. So I > need to connect classes like this:* > * > * > *application->db->mysql->connect, but I can not use extends because in php > you can have only one parent class. The reason why I am trying to do > something like this is because I want to call methods like this: > * > *$test = new application(); > * > *$test->db->connect(); > * > * > * > *If it is mysql or othet database I set in config.php file. Can you help my > please? > * > * > * > *Sincerely, > * > * > * > *Dominik Halvonik > * > -- Ferenc Kovács @Tyr43l - http://tyrael.hu

« previous php.webmaster (#12608) next »