/** * @param User $user */ protected function saveUserCustomFields(User $user) { $this->conn->executeUpdate('DELETE FROM ' . $this->conn->quoteIdentifier($this->userCustomFieldsTableName) . ' WHERE ' . $this->getUserColumns('user_id') . ' = ?', array($user->getId())); foreach ($user->getCustomFields() as $attribute => $value) { $this->conn->executeUpdate('INSERT INTO ' . $this->conn->quoteIdentifier($this->userCustomFieldsTableName) . ' (' . $this->getUserColumns('user_id') . ', ' . $this->getUserColumns('attribute') . ', ' . $this->getUserColumns('value') . ') VALUES (?, ?, ?) ', array($user->getId(), $attribute, $value)); } }