/**
* Getter for username
*
- * @return $userName The username to set
+ * @return $userName The username to get
*/
public final function getUsername () {
return $this->userNane;
}
+
+ /**
+ * Determines wether the username exists or not
+ *
+ * @return $exists Wether the username exists
+ */
+ protected function ifUsernameExists () {
+ // By default the username does exist
+ $exists = true;
+
+ // Get a UserDatabaseWrapper instance
+ $wrapperInstance = UserDatabaseWrapper::createUserDatabaseWrapper();
+
+ // Create a search criteria
+ $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria');
+
+ // Add the username as a criteria and set limit to one entry
+ $criteriaInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_USERNAME, $this->getUsername());
+ $criteriaInstance->setLimit(1);
+
+ // Get a search result
+ $result = $wrapperInstance->doSelectByCriteria($criteriaInstance);
+
+ // Search for it
+ if ($result->next()) {
+ // Entry found, so all is fine
+ $exists = true;
+ }
+
+ // Return the status
+ return $exists;
+ }
}
// [EOF]