I'm trying to anonymize my user records - and part of that process is to change the username to an anonymous string. The username, however, is the primary key of the users table. So, this code:
$new_username = $this->getAnonymousUsername(); $this->username = $new_username; $this->password = $new_username; $this->email = ''; $this->first_name = 'Anonymous'; $this->last_name = 'Record'; $this->save();
gives me this query:
UPDATE `user` SET `password` = '__anon__d9e0fb0f0da033e2eeb6898b86db7787', `source` = '', `email` = '', `first_name` = 'Anonymous', `last_name` = 'Record', `role` = 'Student' WHERE `username` = '__anon__d9e0fb0f0da033e2eeb6898b86db7787'
Is there anything I can do without resorting to PHQL (which is fine if that's what I have to do), to get the username to update?