- XDB::execute("REPLACE INTO mentor (uid, expertise)
- VALUES ({?}, {?})",
- S::i('uid'), $this->values['expertise']);
+ $expertise = trim($this->values['expertise']);
+ if (empty($expertise)) {
+ XDB::execute("DELETE FROM profile_mentor
+ WHERE uid = {?}",
+ $this->pid());
+ $this->values['expertise'] = null;
+ } else {
+ XDB::execute("REPLACE INTO profile_mentor (uid, expertise)
+ VALUES ({?}, {?})",
+ $this->pid(), $expertise);
+ $this->values['expertise'] = $expertise;
+ }