original_string: protected function saveEventTags(int $iEventId, array $aTags)
      {
          // Delete existing tags
          $this->queryPDO(
              'DELETE FROM `sked_event_tags` WHERE `sked_event_id` = ?',
              [$iEventId]
          );
  
          // Create new tags
          if (!empty($aTags)) {
              $aValueSets = [];
              $aExecParams[':sked_event_id'] = $iEventId;
              $strQuery = 'INSERT INTO `sked_event_tags` (`sked_event_id`, `tag_id`, `value`, `created_at`) VALUES ';
              foreach ($aTags as $iTagId => $mTagValue) {
                  $strTagParam = ':tag_id_' . $iTagId;
                  $strValueParam = ':value_' . $iTagId;
                  $aValueSets[] = '(:sked_event_id, ' . $strTagParam . ', ' . $strValueParam . ', NOW())';
                  $aExecParams[$strTagParam] = $iTagId;
                  $aExecParams[$strValueParam] = $mTagValue;
              }
              $strQuery .= implode(',', $aValueSets);
  
              $this->queryPDO($strQuery, $aExecParams);
          }
  
          return true;
      }
code: protected function saveEventTags(int $iEventId, array $aTags)
      {
          // Delete existing tags
          $this->queryPDO(
              'DELETE FROM `sked_event_tags` WHERE `sked_event_id` = ?',
              [$iEventId]
          );
  
          // Create new tags
          if (!empty($aTags)) {
              $aValueSets = [];
              $aExecParams[':sked_event_id'] = $iEventId;
              $strQuery = 'INSERT INTO `sked_event_tags` (`sked_event_id`, `tag_id`, `value`, `created_at`) VALUES ';
              foreach ($aTags as $iTagId => $mTagValue) {
                  $strTagParam = ':tag_id_' . $iTagId;
                  $strValueParam = ':value_' . $iTagId;
                  $aValueSets[] = '(:sked_event_id, ' . $strTagParam . ', ' . $strValueParam . ', NOW())';
                  $aExecParams[$strTagParam] = $iTagId;
                  $aExecParams[$strValueParam] = $mTagValue;
              }
              $strQuery .= implode(',', $aValueSets);
  
              $this->queryPDO($strQuery, $aExecParams);
          }
  
          return true;
      }
code_tokens: protected function saveEventTags ( int $ iEventId , array $ aTags ) { // Delete existing tags $ this -> queryPDO ( 'DELETE FROM `sked_event_tags` WHERE `sked_event_id` = ?' , [ $ iEventId ] ) ; // Create new tags if ( ! empty ( $ aTags ) ) { $ aValueSets = [ ] ; $ aExecParams [ ':sked_event_id' ] = $ iEventId ; $ strQuery = 'INSERT INTO `sked_event_tags` (`sked_event_id`, `tag_id`, `value`, `created_at`) VALUES ' ; foreach ( $ aTags as $ iTagId => $ mTagValue ) { $ strTagParam = ':tag_id_' . $ iTagId ; $ strValueParam = ':value_' . $ iTagId ; $ aValueSets [ ] = '(:sked_event_id, ' . $ strTagParam . ', ' . $ strValueParam . ', NOW())' ; $ aExecParams [ $ strTagParam ] = $ iTagId ; $ aExecParams [ $ strValueParam ] = $ mTagValue ; } $ strQuery .= implode ( ',' , $ aValueSets ) ; $ this -> queryPDO ( $ strQuery , $ aExecParams ) ; } return true ; }
docstring: Persist event tag data to the database.
  
  @param int $iEventId Event that owns the tags.
  @param array $aTags Array of data to persist.
  @return bool true On success.
  @throws \Exception On failure.
docstring_tokens: Persist event tag data to the database .