Beispiel #1
0
 /**
  * One_Renderer_Interspire renders an instance of One_Query into an understandable "query" for Interspire
  * @param One_Query $query
  * @return array
  */
 public function render(One_Query $query)
 {
     $this->query = $query;
     $this->scheme = $this->query->getScheme();
     $resources = $this->scheme->getResources();
     // add possible filters to the query
     if (isset($resources['filter'])) {
         $filters = explode(';', $resources['filter']);
         if (count($filters) > 0) {
             foreach ($filters as $filterName) {
                 if ($filterName != '') {
                     $filter = One_Repository::getFilter($filterName, $query->getScheme()->name());
                     $filter->affect($query);
                 }
             }
         }
     }
     $details = array();
     // For interspire, you can basicly only use the where clauses and even still only certain fields
     // The validation of the fields must be done in the functions themselves because they are too random
     // get where clauses
     $whereClauses = $query->getWhereClauses();
     if (!is_null($whereClauses)) {
         $details = $this->whereClauses($whereClauses);
     }
     $order = $query->getOrder();
     if (!is_null($query->getOrder())) {
         $details['SortInfo'] = $this->createOrder();
     }
     return $details;
 }
Beispiel #2
0
 /**
  * Get the table used for the scheme
  *
  * @param One_Scheme $scheme
  * @return string Table name used for the scheme
  */
 protected function getTable(One_Scheme $scheme)
 {
     $resources = $scheme->getResources();
     if (isset($resources['table'])) {
         return $resources['table'];
     } else {
         throw new One_Exception('A table must be defined for the scheme "' . $scheme->getName() . '"');
     }
 }