php - Method is not return correct value -


i breaking head on problem whole day already, , cant figure out why code behaving this. using pdo data database , when var_dump $stmt->fetchall() expected results(an array 2 objects) when call method , var_dump result object calls method.

the user class derives orm class

the code follows:

in index.php user::find(1);


in orm.php

protected static $table_name; private $query;  public function __construct() {   $this->query = new query(static::$table_name); }   public static function find($id, $columns = "*") {   $user = user::get($columns, get_called_class(), pdo::fetch_class);   return $user; }  public static function findall($columns = "*") {   return user::get($columns); }  /**  * magic method call methods  */ public function __call($method, $args = array()) { call_user_func_array( array( $this->query, $method ), $args); return $this; }  /**  * magic method call static methods  */ public static function __callstatic($method, $args = array()) {   $static = new static;   call_user_func_array( array( $static->query, $method ), $args);   return $static; 

}


and in query.php

 public function get($columns = "*", $class_name = "", $fetch_mode = pdo::fetch_assoc)       {    $stm = db::prepare("select * user");//the db class working    $stm->execute();    $fetch = $stm->fetchall();    var_dump($fetch); // prints correct array 2 users in    return $fetch; // doesnt return somehow  } 

thanks in advance have no idea how fix this, looking @ problem entire day already

robert

user::find(1);  find($id, $columns = "*") {   $user = user::get($columns, get_called_class(), pdo::fetch_class);   return $user; 

in call find passing 1 guess $id in passing $columns means me not passing $id

in summary, me looks passing 1 not doing ?

let me know if fixes ?


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -