sangoku Posted February 22, 2010 Share Posted February 22, 2010 Any sugestions how to optimize this I have a class which when called makes a query to the BD and populates it self. <?php class name { private $DB_table_name= 'somthing'; private $table_fields = array('bla', 'pi','po'); private $bla; private $pi; private $po; function __construct($user_id){ // it gets the data and populates it self, mean the bla pi po //each private is a representation of a value in the row of a DB } } //now here is the roblem i have a class which extends this class class damn extends name { // now here i have some other data private $pika; private $toka; private $njanajnjanaja; //here i have a function function __construct ($input){ $this->doSome(); } private function doSome(){ //do some //and hee is the problem i need to make some changes in the name class BUT it needs to be in this object // i use a function which copys the resulting object into the vlaues of this object $parent_object = new name($this->toka); //and now i sopy the result into the object via some while loops //is there a bether way to popoulate this object ???? // the copyng ceates much overhead..... } } ?> the coping creates much over head can i somehow avoid it? Quote Link to comment https://forums.phpfreaks.com/topic/192866-is-there-a-bether-more-oop-way/ 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.