tinymvc-php icon indicating copy to clipboard operation
tinymvc-php copied to clipboard

PDO::FETCH_CLASS

Open ckrudelux opened this issue 10 years ago • 0 comments

Notice that PDO::FETCH_CLASS wasn't supported by the TinyMVC_PDO class $fetch_mode. By adding $class and $ctorargs arguments on all method using $fetch_mode. Plus side is that PDO::FETCH_INTO now works aswell

Example:

public function next($fetch_mode=null,$class=null,$ctorargs=null)
public function query($query,$params,$fetch_mode=null,$class=null,$ctorargs=null)

Inside the method:

/* get result with fetch mode */
if( $class ){
    if( is_null($ctorargs) ){
        $this->result->setFetchMode($fetch_mode,$class);
    }else{
        $this->result->setFetchMode($fetch_mode,$class,$ctorargs);
    }
}else{
    $this->result->setFetchMode($fetch_mode);
}

ckrudelux avatar Jan 06 '16 21:01 ckrudelux