original_string: public function getDatabaseSeriesData(Criteria $criteria)
      {
          $dbData = [];
  
          $res = $this->database->query("SELECT {$criteria->getValueField()} AS value,
  calendar.week AS week,
  calendar.month AS month,
  calendar.year AS year,
  {$this->getSeries($criteria->getSeries())}
  {$criteria->getTableName()}.id
  FROM {$criteria->getTableName()}
  INNER JOIN calendar ON date({$criteria->getTableName()}.{$criteria->getTimeField()}) = calendar.date
      AND calendar.date >= '{$criteria->getStartDate()}'
  	AND calendar.date <= '{$criteria->getEndDate()}'
      {$criteria->getJoin()}
  WHERE
      {$criteria->getTableName()}.{$criteria->getTimeField()} >= '{$criteria->getStartDate()}' 
  AND {$criteria->getTableName()}.{$criteria->getTimeField()} <= '{$criteria->getEndDate()}'
  	{$criteria->getWhere()}
  GROUP BY calendar.year,calendar.month,calendar.week" . $this->getGroupBy($criteria->getGroupBy()) . '
  		');
  
          foreach ($res as $row) {
              $value = 0;
              if ($row->id != null) {
                  $value = $row['value'];
              }
              $date = new \DateTime();
              $date->setISODate($row->year, $row->week);
              if (isset($row->name)) {
                  $dbData[$row->name][$date->format('Y-m-d')] = $value;
              } else {
                  $dbData[' '][$date->format('Y-m-d')] = $value;
              }
          }
          return $dbData;
      }
code: public function getDatabaseSeriesData(Criteria $criteria)
      {
          $dbData = [];
  
          $res = $this->database->query("SELECT {$criteria->getValueField()} AS value,
  calendar.week AS week,
  calendar.month AS month,
  calendar.year AS year,
  {$this->getSeries($criteria->getSeries())}
  {$criteria->getTableName()}.id
  FROM {$criteria->getTableName()}
  INNER JOIN calendar ON date({$criteria->getTableName()}.{$criteria->getTimeField()}) = calendar.date
      AND calendar.date >= '{$criteria->getStartDate()}'
  	AND calendar.date <= '{$criteria->getEndDate()}'
      {$criteria->getJoin()}
  WHERE
      {$criteria->getTableName()}.{$criteria->getTimeField()} >= '{$criteria->getStartDate()}' 
  AND {$criteria->getTableName()}.{$criteria->getTimeField()} <= '{$criteria->getEndDate()}'
  	{$criteria->getWhere()}
  GROUP BY calendar.year,calendar.month,calendar.week" . $this->getGroupBy($criteria->getGroupBy()) . '
  		');
  
          foreach ($res as $row) {
              $value = 0;
              if ($row->id != null) {
                  $value = $row['value'];
              }
              $date = new \DateTime();
              $date->setISODate($row->year, $row->week);
              if (isset($row->name)) {
                  $dbData[$row->name][$date->format('Y-m-d')] = $value;
              } else {
                  $dbData[' '][$date->format('Y-m-d')] = $value;
              }
          }
          return $dbData;
      }
code_tokens: public function getDatabaseSeriesData ( Criteria $ criteria ) { $ dbData = [ ] ; $ res = $ this -> database -> query ( "SELECT {$criteria->getValueField()} AS value,
  calendar.week AS week,
  calendar.month AS month,
  calendar.year AS year,
  {$this->getSeries($criteria->getSeries())}
  {$criteria->getTableName()}.id
  FROM {$criteria->getTableName()}
  INNER JOIN calendar ON date({$criteria->getTableName()}.{$criteria->getTimeField()}) = calendar.date
      AND calendar.date >= '{$criteria->getStartDate()}'
  	AND calendar.date <= '{$criteria->getEndDate()}'
      {$criteria->getJoin()}
  WHERE
      {$criteria->getTableName()}.{$criteria->getTimeField()} >= '{$criteria->getStartDate()}' 
  AND {$criteria->getTableName()}.{$criteria->getTimeField()} <= '{$criteria->getEndDate()}'
  	{$criteria->getWhere()}
  GROUP BY calendar.year,calendar.month,calendar.week" . $ this -> getGroupBy ( $ criteria -> getGroupBy ( ) ) . '
  		' ) ; foreach ( $ res as $ row ) { $ value = 0 ; if ( $ row -> id != null ) { $ value = $ row [ 'value' ] ; } $ date = new \ DateTime ( ) ; $ date -> setISODate ( $ row -> year , $ row -> week ) ; if ( isset ( $ row -> name ) ) { $ dbData [ $ row -> name ] [ $ date -> format ( 'Y-m-d' ) ] = $ value ; } else { $ dbData [ ' ' ] [ $ date -> format ( 'Y-m-d' ) ] = $ value ; } } return $ dbData ; }
docstring: pridat do vsetkych queries ?
docstring_tokens: pridat do vsetkych queries ?