public function execUpdate($redirectAction = false)
    {
        // database translations
        $this->loadTranslations('database', sprintf('private/global/locales/%s/database.ini', LANGUAGE));
        //validate and extract input
        $input = $this->processSaveInput(filter_input_array(INPUT_POST, $this->configuration['subjects'][$this->name]['CRUD']['inputFields']));
        if($input) {
            //extract primary key value
            $primaryKeyValue = $this->extractPrimaryKeyValue($input, 'a');
            try{
                //ORM insert
                $this->purgePrimaryKeyValue($input);
                if($this->update($primaryKeyValue, $input)) {
                    $this->messages->save('cookies','success',sprintf($this->translations[$this->name]['CRUD']['update-success'], $this->translations[$this->name]['singular']));
                }
            } catch(\PDOException $exception) {
                $this->messages->save('cookies', 'danger', $this->handleError($exception));
                if(!isset($redirectAction)) {
                    $redirectAction = 'update-form/' . $this->extractPrimaryKeyValue($input, 's');
                }
            }
        }
        //redirect
        $redirectAction = $redirectAction ? $redirectAction : 'list';
        $this->httpResponse = $this->httpResponse->withHeader('Location', $redirectAction);
    }
public function execUpdate($redirectAction = false)
    {
        // database translations
        $this->loadTranslations('database', sprintf('private/global/locales/%s/database.ini', LANGUAGE));
        //validate and extract input
        $input = $this->processSaveInput(filter_input_array(INPUT_POST, $this->configuration['subjects'][$this->name]['CRUD']['inputFields']));
        if($input) {
            //extract primary key value
            $primaryKeyValue = $this->extractPrimaryKeyValue($input, 'a');
            try{
                //ORM insert
                $this->purgePrimaryKeyValue($input);
                if($this->update($primaryKeyValue, $input)) {
                    $this->messages->save('cookies','success',sprintf($this->translations[$this->name]['CRUD']['update-success'], $this->translations[$this->name]['singular']));
                }
            } catch(\PDOException $exception) {
                $this->messages->save('cookies', 'danger', $this->handleError($exception));
                if(!isset($redirectAction)) {
                    $redirectAction = 'update-form/' . $this->extractPrimaryKeyValue($input, 's');
                }
            }
        }
        //redirect
        $redirectAction = $redirectAction ? $redirectAction : 'list';
        $this->httpResponse = $this->httpResponse->withHeader('Location', $redirectAction);
    }
public function execUpdate ( $ redirectAction = false ) { // database translations $ this -> loadTranslations ( 'database' , sprintf ( 'private/global/locales/%s/database.ini' , LANGUAGE ) ) ; //validate and extract input $ input = $ this -> processSaveInput ( filter_input_array ( INPUT_POST , $ this -> configuration [ 'subjects' ] [ $ this -> name ] [ 'CRUD' ] [ 'inputFields' ] ) ) ; if ( $ input ) { //extract primary key value $ primaryKeyValue = $ this -> extractPrimaryKeyValue ( $ input , 'a' ) ; try { //ORM insert $ this -> purgePrimaryKeyValue ( $ input ) ; if ( $ this -> update ( $ primaryKeyValue , $ input ) ) { $ this -> messages -> save ( 'cookies' , 'success' , sprintf ( $ this -> translations [ $ this -> name ] [ 'CRUD' ] [ 'update-success' ] , $ this -> translations [ $ this -> name ] [ 'singular' ] ) ) ; } } catch ( \ PDOException $ exception ) { $ this -> messages -> save ( 'cookies' , 'danger' , $ this -> handleError ( $ exception ) ) ; if ( ! isset ( $ redirectAction ) ) { $ redirectAction = 'update-form/' . $ this -> extractPrimaryKeyValue ( $ input , 's' ) ; } } } //redirect $ redirectAction = $ redirectAction ? $ redirectAction : 'list' ; $ this -> httpResponse = $ this -> httpResponse -> withHeader ( 'Location' , $ redirectAction ) ; }
Update record action
@param string $redirectAction
Update record action