original_string: public function change($id = null)
      {
          if ($id === null || !$this->Languages->exists(['id' => $id])) {
              $this->Flash->error($this->invalidRequestMessage);
              $this->redirect($this->referer());
              return;
          }
          $this->request->session()->write('contentLanguageId', (int)$id);
          $this->redirect($this->referer());
      }
code: public function change($id = null)
      {
          if ($id === null || !$this->Languages->exists(['id' => $id])) {
              $this->Flash->error($this->invalidRequestMessage);
              $this->redirect($this->referer());
              return;
          }
          $this->request->session()->write('contentLanguageId', (int)$id);
          $this->redirect($this->referer());
      }
code_tokens: public function change ( $ id = null ) { if ( $ id === null || ! $ this -> Languages -> exists ( [ 'id' => $ id ] ) ) { $ this -> Flash -> error ( $ this -> invalidRequestMessage ) ; $ this -> redirect ( $ this -> referer ( ) ) ; return ; } $ this -> request -> session ( ) -> write ( 'contentLanguageId' , ( int ) $ id ) ; $ this -> redirect ( $ this -> referer ( ) ) ; }
docstring: Change action
  GET
  
  Change the content language to $id and update the session.
  
  @param string $id The language id.
  @return void
docstring_tokens: Change action GET