code: public function fetchByQuery($query)
  	{
      if (!$query->isSelectSet()) {
        $query->select('*');
      }
      $query->from($this->tableName);
      
      if ($this->viewQuery) {
        echo $query->getQuery();
      }
  
      return $query->fetchAll();
  	}
docs: $query is an instance of a Cora database.