public function findById($id, $format=false)
    {
        $query = $this->getQuery();
        
        if (isset($query['table'])) {
            $pk = $this->getPrimaryKey($query['table'][0]);
        } else {
            $pk = $this->getPrimarykey();
        }
        
        if (!isset($pk)) {
            throw new Exception('Can\'t get primary key of table:' . $this->getTableName());
        }
        
        if (!is_array($id)) {
            $pk = StringHelper::toArray($pk)[0];
            $where = [ $pk => intval($id)];
        } else {
            foreach ($pk as $num => $field) {
                $where[] = array( $field => intval($id[$num]) );
            }
        }
        
        return $this->where($where)->find(null, $format);
    }
public function findById($id, $format=false)
    {
        $query = $this->getQuery();
        
        if (isset($query['table'])) {
            $pk = $this->getPrimaryKey($query['table'][0]);
        } else {
            $pk = $this->getPrimarykey();
        }
        
        if (!isset($pk)) {
            throw new Exception('Can\'t get primary key of table:' . $this->getTableName());
        }
        
        if (!is_array($id)) {
            $pk = StringHelper::toArray($pk)[0];
            $where = [ $pk => intval($id)];
        } else {
            foreach ($pk as $num => $field) {
                $where[] = array( $field => intval($id[$num]) );
            }
        }
        
        return $this->where($where)->find(null, $format);
    }
public function findById ( $ id , $ format = false ) { $ query = $ this -> getQuery ( ) ; if ( isset ( $ query [ 'table' ] ) ) { $ pk = $ this -> getPrimaryKey ( $ query [ 'table' ] [ 0 ] ) ; } else { $ pk = $ this -> getPrimarykey ( ) ; } if ( ! isset ( $ pk ) ) { throw new Exception ( 'Can\'t get primary key of table:' . $ this -> getTableName ( ) ) ; } if ( ! is_array ( $ id ) ) { $ pk = StringHelper :: toArray ( $ pk ) [ 0 ] ; $ where = [ $ pk => intval ( $ id ) ] ; } else { foreach ( $ pk as $ num => $ field ) { $ where [ ] = array ( $ field => intval ( $ id [ $ num ] ) ) ; } } return $ this -> where ( $ where ) -> find ( null , $ format ) ; }
find one by pk, if pk is multi, param is value array, param order must the pk order.

@param  int|array $id
@param  bool  $format
@return array
find one by pk if pk is multi param is value array param order must the pk order .