original_string: public function getAppointmentsForEpisode($episode)
      {
          $select = $this->_getAppointmentSelect();
  
          if ($episode instanceof EpisodeOfCare) {
              $episodeId = $episode->getId();
          } else {
              $episodeId = $episode;
          }
          $select->where('gap_id_episode = ?', $episodeId);
  
          // \MUtil_Echo::track($select->__toString());
          $rows = $this->db->fetchAll($select);
  
          if (! $rows) {
              return array();
          }
  
          $results = array();
          foreach ($rows as $row) {
              $results[$row['gap_id_appointment']] = $this->getAppointment($row);
          }
          return $results;
      }
code: public function getAppointmentsForEpisode($episode)
      {
          $select = $this->_getAppointmentSelect();
  
          if ($episode instanceof EpisodeOfCare) {
              $episodeId = $episode->getId();
          } else {
              $episodeId = $episode;
          }
          $select->where('gap_id_episode = ?', $episodeId);
  
          // \MUtil_Echo::track($select->__toString());
          $rows = $this->db->fetchAll($select);
  
          if (! $rows) {
              return array();
          }
  
          $results = array();
          foreach ($rows as $row) {
              $results[$row['gap_id_appointment']] = $this->getAppointment($row);
          }
          return $results;
      }
code_tokens: public function getAppointmentsForEpisode ( $ episode ) { $ select = $ this -> _getAppointmentSelect ( ) ; if ( $ episode instanceof EpisodeOfCare ) { $ episodeId = $ episode -> getId ( ) ; } else { $ episodeId = $ episode ; } $ select -> where ( 'gap_id_episode = ?' , $ episodeId ) ; // \MUtil_Echo::track($select->__toString()); $ rows = $ this -> db -> fetchAll ( $ select ) ; if ( ! $ rows ) { return array ( ) ; } $ results = array ( ) ; foreach ( $ rows as $ row ) { $ results [ $ row [ 'gap_id_appointment' ] ] = $ this -> getAppointment ( $ row ) ; } return $ results ; }
docstring: Get all appointments for an episode
  
  @param int|Episode $episode Episode Id or object
  @return array appointmentId => appointment object
docstring_tokens: Get all appointments for an episode