Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I try to implement something like:

$data = my_obj::get_rows();

$data is now a PDO Statement,

my_obj is my class ( i have one for every db table ), implements __set and __get magic

get_rows() is a static method that return a PDO Statement.

Now i want convert $data to an my_obj instance, so I can have access to class method, something like :

 while( $d = my_obj::inject( $data ) ){
         $d->my_method();
 }

Now, i try to write my ::inject static method:

     static function inject($pdo_statement) {

        $data = $pdo_statement->fetchAll(PDO::FETCH_ASSOC);

        //and now?

    }

Can anyone help to solve this method?

share|improve this question
 
it really isn't clear what you are trying to do and what your code is currently doing from the examples you've provided. is my_obj a data model (it seems more like a mapper)? –  HorusKol Jul 23 at 1:34
 
my_obj is a mapper that extends my PDO class wrapper. –  Ste Jul 24 at 13:43

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.