Problem Description: Today in the preparation of the api update section, discover how some of the fields are updated update does not go up.
Troubleshooting:
- After several tests and found that each submission can only update some of the fields, the fields are: id, user_id, device_room_id, name, desc
- Test repeatedly found desc field is empty when it can be updated to empty
- Consideration whether a problem is automatically filled, automatic filling detection code found only when judged absent or empty is set to null
- Repair determination, if the present value is set to this value
Resolution code:
// Source Code // set a default value field desc public function setDescAttribute ( $ value ) { IF ( empty ( $ value )) { $ the this -> Attributes [ 'desc'] = '' ; } }
// After modifying the code // Set default value field desc public function setDescAttribute ( $ value ) { IF ( empty ( $ value )) { $ the this -> Attributes [ 'desc'] = '' ; } the else { $ the this -> Attributes [ 'desc'] = $ value ; } }