public function transformPhotographers()
 {
     $this->photogKeys = array();
     $dom = DOMDocument::load("tuftsph_jm2db.xml");
     $photogs = $dom->getElementsByTagName("photogs");
     $total = $photogs->length;
     $count = 1;
     echo "Converting Photographers \n";
     foreach ($photogs as $pr) {
         echo $count . "/" . $total . "\n";
         $count += 1;
         $childNodes = $pr->childNodes;
         $i = array();
         foreach ($childNodes as $child) {
             $i[$child->nodeName] = $child->textContent;
         }
         list($firstName, $lastName) = explode(" ", $i["name"]);
         if (strlen($i["email"]) == 0 || is_null($i["email"])) {
             $i["email"] = "NO_EMAIL_" . $count . "@TUFTS.EDU";
         }
         $user = new sfGuardUser();
         $user->setUsername($i["email"]);
         $user->setPassword("");
         $user->setAlgorithm("sha1");
         $user->save();
         $profile = new sfGuardUserProfile();
         $profile->setUserId($user->getId());
         $profile->setUserTypeId(sfConfig::get("app_user_type_photographer"));
         $profile->setEmail($i["email"]);
         $profile->setFirstName($firstName);
         $profile->setLastName($lastName);
         $profile->save();
         $ph = new Photographer();
         $ph->setUserId($profile->getId());
         $ph->setName($i["name"]);
         $ph->setPhone($i["phone"]);
         $ph->setEmail($i["email"]);
         $ph->setAffiliation($i["affiliation"]);
         $ph->save();
         $this->photogKeys[$i["photog_id"]] = $ph->getId();
     }
 }
 protected function createUserAndProfile($username, $con = null)
 {
     // no user with this username
     if (null === $con) {
         $con = Propel::getConnection(sfGuardUserPeer::DATABASE_NAME);
     }
     try {
         $con->begin();
         // create a new user object
         $user = new sfGuardUser();
         $user->setUsername($username);
         $user->setIsActive(1);
         $user->setAlgorithm('');
         $user->save($con);
         // do we have a profile in the system with this net_id?
         // this could happen if the profile was added manually by an admin
         $userProfile = UserProfilePeer::selectByNetIdWithNoUserId($username);
         if ($userProfile) {
             // there is already a dangling user profile with this net id, link the user with the profile
             $userProfile->setUserId($user->getId());
             $userProfile->save($con);
         } else {
             // make a new user profile
             $userProfile = new UserProfile();
             $userProfile->setUserId($user->getId());
             $userProfile->setNetId($user->getUsername());
             $userProfile->save($con);
         }
         $con->commit();
     } catch (PropelException $e) {
         $con->rollback();
         throw $e;
     }
     return $user;
 }