-
- // Get database instance
- $dbInstance = $personellInstance->getDatabaseInstance();
-
- // Is this a valid database instance?
- if (is_null($dbInstance)) {
- // No class returned
- throw new NullPointerException($personellInstance, self::EXCEPTION_IS_NULL_POINTER);
- } elseif (!is_object($dbInstance)) {
- // Not an object! ;-(
- throw new NoObjectException($dbInstance, self::EXCEPTION_IS_NO_OBJECT);
- } elseif (!method_exists($dbInstance, 'isUniqueIdUsed')) {
- // Required method not found
- throw new MissingMethodException(array($dbInstance, 'isUniqueIdUsed'), self::EXCEPTION_MISSING_METHOD);
- }
-
- // Is the unique ID already used? Then it must be there!
- if (!$dbInstance->isUniqueIdUsed($tempID)) {
- // Entry not found!
- throw new MissingSimulatorIDException(array($personellInstance, $idNumber), self::EXCEPTION_SIMULATOR_ID_INVALID);
- }
-
- // Load the personell list and add it to this object
- $personellInstance->loadPersonellList($tempID);
-
- // Clean-up a little
- $personellInstance->removeGender();
- $personellInstance->removeNames();
- $personellInstance->removeBirthday();
- $personellInstance->removeSalary();
- $personellInstance->removeEmployed();
- $personellInstance->removeMarried();
- $personellInstance->removeNumberFormaters();
- //$personellInstance->removeCache();
- $personellInstance->removeSystemArray();
-
- // Return instance
- return $personellInstance;