tombenner / wp-mvc

An MVC framework for WordPress
http://wpmvc.org
MIT License
625 stars 171 forks source link

Upload will insert new row when setup primary key at model ? #199

Closed tuanrobe1989 closed 6 years ago

tuanrobe1989 commented 6 years ago

When i change primary key at model to new character ID, After saved will add new row, not update this row, I found cause and fixed At line 30 core/helpers/mvc_form_helper.php $html .= '<input type="hidden" id="'.$this->input_id('hidden_id').'" name="'.$this->input_name('id').'" value="'.$object_id.'" />'; Replace to below: $html .= '<input type="hidden" id="'.$this->input_id('hidden_id').'" name="data['.$this->model->name.']['.$this->model->primary_key.']" value="'.$object_id.'" />'; Thanks

cyberscribe commented 6 years ago

Thanks. Please submit a pull request if you think you have found a bug. :)

On 17 November 2017 at 10:37, tuanrobe1989 notifications@github.com wrote:

When i change primary key at model to new character ID, After saved will add new row, not update this row, I found cause and fixed At line 30 core/helpers/mvc_form_helper.php $html .= ''; Replace to below: $html .= ''; Thanks

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tombenner/wp-mvc/issues/199, or mute the thread https://github.com/notifications/unsubscribe-auth/AAqV5aCy2ELeDB3KUyVKM6S3P0H2Dr19ks5s3WHZgaJpZM4Qh2Kf .