original_string: public function onGenerateAlias($value, DataContainer $dc)
      {
          $autoAlias = false;
  
          // Generate alias if there is none
          if (!$value) {
              $autoAlias = true;
              $value = StringUtil::generateAlias($dc->activeRecord->frontendTitle ?: $dc->activeRecord->title);
          }
  
          if (MultilingualHelper::isActive() && $dc instanceof Driver) {
              $exists = $this->db->fetchColumn(
                  "SELECT id FROM {$dc->table} WHERE alias=? AND id!=? AND {$dc->getLanguageColumn()}=?",
                  [$value, $dc->activeRecord->id, $dc->getCurrentLanguage()]
              );
          } else {
              $exists = $this->db->fetchColumn(
                  "SELECT id FROM {$dc->table} WHERE alias=? AND id!=?",
                  [$value, $dc->activeRecord->id]
              );
          }
  
          // Check whether the category alias exists
          if ($exists) {
              if ($autoAlias) {
                  $value .= '-'.$dc->activeRecord->id;
              } else {
                  throw new \RuntimeException(\sprintf($GLOBALS['TL_LANG']['ERR']['aliasExists'], $value));
              }
          }
  
          return $value;
      }
code: public function onGenerateAlias($value, DataContainer $dc)
      {
          $autoAlias = false;
  
          // Generate alias if there is none
          if (!$value) {
              $autoAlias = true;
              $value = StringUtil::generateAlias($dc->activeRecord->frontendTitle ?: $dc->activeRecord->title);
          }
  
          if (MultilingualHelper::isActive() && $dc instanceof Driver) {
              $exists = $this->db->fetchColumn(
                  "SELECT id FROM {$dc->table} WHERE alias=? AND id!=? AND {$dc->getLanguageColumn()}=?",
                  [$value, $dc->activeRecord->id, $dc->getCurrentLanguage()]
              );
          } else {
              $exists = $this->db->fetchColumn(
                  "SELECT id FROM {$dc->table} WHERE alias=? AND id!=?",
                  [$value, $dc->activeRecord->id]
              );
          }
  
          // Check whether the category alias exists
          if ($exists) {
              if ($autoAlias) {
                  $value .= '-'.$dc->activeRecord->id;
              } else {
                  throw new \RuntimeException(\sprintf($GLOBALS['TL_LANG']['ERR']['aliasExists'], $value));
              }
          }
  
          return $value;
      }
code_tokens: public function onGenerateAlias ( $ value , DataContainer $ dc ) { $ autoAlias = false ; // Generate alias if there is none if ( ! $ value ) { $ autoAlias = true ; $ value = StringUtil :: generateAlias ( $ dc -> activeRecord -> frontendTitle ? : $ dc -> activeRecord -> title ) ; } if ( MultilingualHelper :: isActive ( ) && $ dc instanceof Driver ) { $ exists = $ this -> db -> fetchColumn ( "SELECT id FROM {$dc->table} WHERE alias=? AND id!=? AND {$dc->getLanguageColumn()}=?" , [ $ value , $ dc -> activeRecord -> id , $ dc -> getCurrentLanguage ( ) ] ) ; } else { $ exists = $ this -> db -> fetchColumn ( "SELECT id FROM {$dc->table} WHERE alias=? AND id!=?" , [ $ value , $ dc -> activeRecord -> id ] ) ; } // Check whether the category alias exists if ( $ exists ) { if ( $ autoAlias ) { $ value .= '-' . $ dc -> activeRecord -> id ; } else { throw new \ RuntimeException ( \ sprintf ( $ GLOBALS [ 'TL_LANG' ] [ 'ERR' ] [ 'aliasExists' ] , $ value ) ) ; } } return $ value ; }
docstring: On generate the category alias.
  
  @param string        $value
  @param DataContainer $dc
  
  @throws \RuntimeException
  
  @return string
docstring_tokens: On generate the category alias .