// Constants for database columns
const DB_COLUMN_USERNAME = "username";
+ const DB_COLUMN_EMAIL = "email";
// Constants for database table names
const DB_TABLE_USER = "user";
// Return the status
return $exists;
}
+
+ /**
+ * Determines wether the email exists or not
+ *
+ * @return $exists Wether the email exists
+ */
+ public function ifEmailAddressExists () {
+ // 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_EMAIL, $this->getEmail());
+ $criteriaInstance->setLimit(1);
+
+ // Get a search result
+ $result = $wrapperInstance->doSelectByCriteria($criteriaInstance);
+
+ // Search for it
+ if (!$result->next()) {
+ // Entry not found
+ $exists = false;
+ } // END - if
+
+ // Return the status
+ return $exists;
+ }
}
// [EOF]