* @param $className Name of the class
* @return void
*/
- protected function __construct ($className = "") {
- // Is the class name empty? Then this is not a specialized user class
- if (empty($className)) $className = __CLASS__;
-
+ protected function __construct ($className = __CLASS__) {
// Call parent constructor
parent::__construct($className);
+ }
- // Set part description
- $this->setObjectDescription("Special member class for Ship-Simu");
+ /**
+ * Destructor for e.g. flushing pending updates to the database
+ *
+ * @return void
+ */
+ public function __destruct () {
+ // Flush any updated entries to the database
+ $this->flushPendingUpdates();
- // Create unique ID number
- $this->generateUniqueId();
+ // Call parent destructor
+ parent::__destruct();
}
/**
*
* @param $requestInstance An instance of a Requestable class
* @return $userInstance An instance of this user class
+ * @todo Add more ways of creating user instances
*/
public final static function createMemberByRequest (Requestable $requestInstance) {
// Determine if by email or username
$updateInstance = ObjectFactory::createObjectByConfiguredName('update_criteria_class');
// And add our both entries
- $updateInstance->addCriteria('last_activity', date("Y-m-d H:i:s", time()));
- $updateInstance->addCriteria('last_action', $lastAction);
+ $updateInstance->addCriteria("last_activity", date("Y-m-d H:i:s", time()));
+ $updateInstance->addCriteria("last_action", $lastAction);
// Add the search criteria for searching for the right entry
$updateInstance->setSearchInstance($searchInstance);