Jump to content

is there a bether, more OOP way?


sangoku

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/192866-is-there-a-bether-more-oop-way/
Share on other sites

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.