original_string: protected function setAfterSendRoute()
      {
          if ($this->routeAction && ($this->request->getActionName() !== $this->routeAction)) {
              $this->afterSendRouteUrl = array('action' => $this->routeAction);
  
              $keys  = $this->model->getKeys();
              if (count($keys) == 1) {
                  $key = reset($keys);
                  if (isset($this->formData[$key])) {
                      $this->afterSendRouteUrl[\MUtil_Model::REQUEST_ID] = $this->formData[$key];
                  }
              } else {
                  $i = 1;
                  foreach ($keys as $key) {
                      if (isset($this->formData[$key])) {
                          $this->afterSendRouteUrl[\MUtil_Model::REQUEST_ID . $i] = $this->formData[$key];
                      }
                      $i++;
                  }
              }
  
              $this->afterSendRouteUrl['controller'] = $this->request->getControllerName();
  
              $find['action'] = $this->afterSendRouteUrl['action'];
              $find['controller'] = $this->afterSendRouteUrl['controller'];
  
              if (null == $this->menu->find($find)) {
                  $this->afterSendRouteUrl['action'] = 'index';
                  $this->resetRoute = true;
              }
          }
      }
code: protected function setAfterSendRoute()
      {
          if ($this->routeAction && ($this->request->getActionName() !== $this->routeAction)) {
              $this->afterSendRouteUrl = array('action' => $this->routeAction);
  
              $keys  = $this->model->getKeys();
              if (count($keys) == 1) {
                  $key = reset($keys);
                  if (isset($this->formData[$key])) {
                      $this->afterSendRouteUrl[\MUtil_Model::REQUEST_ID] = $this->formData[$key];
                  }
              } else {
                  $i = 1;
                  foreach ($keys as $key) {
                      if (isset($this->formData[$key])) {
                          $this->afterSendRouteUrl[\MUtil_Model::REQUEST_ID . $i] = $this->formData[$key];
                      }
                      $i++;
                  }
              }
  
              $this->afterSendRouteUrl['controller'] = $this->request->getControllerName();
  
              $find['action'] = $this->afterSendRouteUrl['action'];
              $find['controller'] = $this->afterSendRouteUrl['controller'];
  
              if (null == $this->menu->find($find)) {
                  $this->afterSendRouteUrl['action'] = 'index';
                  $this->resetRoute = true;
              }
          }
      }
code_tokens: protected function setAfterSendRoute ( ) { if ( $ this -> routeAction && ( $ this -> request -> getActionName ( ) !== $ this -> routeAction ) ) { $ this -> afterSendRouteUrl = array ( 'action' => $ this -> routeAction ) ; $ keys = $ this -> model -> getKeys ( ) ; if ( count ( $ keys ) == 1 ) { $ key = reset ( $ keys ) ; if ( isset ( $ this -> formData [ $ key ] ) ) { $ this -> afterSendRouteUrl [ \ MUtil_Model :: REQUEST_ID ] = $ this -> formData [ $ key ] ; } } else { $ i = 1 ; foreach ( $ keys as $ key ) { if ( isset ( $ this -> formData [ $ key ] ) ) { $ this -> afterSendRouteUrl [ \ MUtil_Model :: REQUEST_ID . $ i ] = $ this -> formData [ $ key ] ; } $ i ++ ; } } $ this -> afterSendRouteUrl [ 'controller' ] = $ this -> request -> getControllerName ( ) ; $ find [ 'action' ] = $ this -> afterSendRouteUrl [ 'action' ] ; $ find [ 'controller' ] = $ this -> afterSendRouteUrl [ 'controller' ] ; if ( null == $ this -> menu -> find ( $ find ) ) { $ this -> afterSendRouteUrl [ 'action' ] = 'index' ; $ this -> resetRoute = true ; } } }
docstring: Set the route destination after the mail is sent
docstring_tokens: Set the route destination after the mail is sent