original_string: public function editAction($id)
      {
          $profile = Profiles::findFirstById($id);
          if (!$profile) {
              $this->flash->error("Profile was not found");
              return $this->dispatcher->forward([
                  'action' => 'index'
              ]);
          }
  
          if ($this->request->isPost()) {
  
              $profile->assign([
                  'name' => $this->request->getPost('name', 'striptags'),
                  'active' => $this->request->getPost('active')
              ]);
  
              if (!$profile->save()) {
                  $this->flash->error($profile->getMessages());
              } else {
                  $this->flash->success("Profile was updated successfully");
              }
  
              Tag::resetInput();
          }
  
          $this->view->form = new ProfilesForm($profile, [
              'edit' => true
          ]);
  
          $this->view->profile = $profile;
      }
code: public function editAction($id)
      {
          $profile = Profiles::findFirstById($id);
          if (!$profile) {
              $this->flash->error("Profile was not found");
              return $this->dispatcher->forward([
                  'action' => 'index'
              ]);
          }
  
          if ($this->request->isPost()) {
  
              $profile->assign([
                  'name' => $this->request->getPost('name', 'striptags'),
                  'active' => $this->request->getPost('active')
              ]);
  
              if (!$profile->save()) {
                  $this->flash->error($profile->getMessages());
              } else {
                  $this->flash->success("Profile was updated successfully");
              }
  
              Tag::resetInput();
          }
  
          $this->view->form = new ProfilesForm($profile, [
              'edit' => true
          ]);
  
          $this->view->profile = $profile;
      }
code_tokens: public function editAction ( $ id ) { $ profile = Profiles :: findFirstById ( $ id ) ; if ( ! $ profile ) { $ this -> flash -> error ( "Profile was not found" ) ; return $ this -> dispatcher -> forward ( [ 'action' => 'index' ] ) ; } if ( $ this -> request -> isPost ( ) ) { $ profile -> assign ( [ 'name' => $ this -> request -> getPost ( 'name' , 'striptags' ) , 'active' => $ this -> request -> getPost ( 'active' ) ] ) ; if ( ! $ profile -> save ( ) ) { $ this -> flash -> error ( $ profile -> getMessages ( ) ) ; } else { $ this -> flash -> success ( "Profile was updated successfully" ) ; } Tag :: resetInput ( ) ; } $ this -> view -> form = new ProfilesForm ( $ profile , [ 'edit' => true ] ) ; $ this -> view -> profile = $ profile ; }
docstring: Edits an existing Profile
  
  @param int $id
docstring_tokens: Edits an existing Profile