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);
    }