/** * Serialize the form into the database. **/ public function save($con = null) { if (!is_null($this->getValue("photographer_id"))) { $p = $this->getObject(); } else { $sfUser = new sfGuardUser(); $sfUser->setUsername($this->getValue("email")); $sfUser->setPassword($this->getValue("password")); $sfUser->save(); if (strpos($this->getValue("name"), " ") !== false) { list($firstName, $lastName) = explode(" ", $this->getValue("name")); } else { $firstName = ""; $lastName = ""; } $sfProfile = new sfGuardUserProfile(); $sfProfile->setUserTypeId(sfConfig::get("app_user_type_photographer")); $sfProfile->setUserId($sfUser->getId()); $sfProfile->setEmail($this->getValue("email")); $sfProfile->setFirstName($firstName); $sfProfile->setLastName($lastName); $sfProfile->save(); $p = new Photographer(); $p->setUserId($sfProfile->getId()); } $p->setName($this->getValue("name")); $p->setEmail($this->getValue("email")); $p->setPhone($this->getValue("phone")); $p->setAffiliation($this->getValue("affiliation")); $p->setWebsite($this->getValue("website")); $p->setDescription($this->getValue("description")); $p->setBillingAddress($this->getValue("billing_info")); $p->save(); if ($this->getValue("reset_password")) { $user = $p->getsfGuardUserProfile()->getsfGuardUser(); $user->setPassword($this->getValue("password")); $user->save(); } }