Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.