protected function doProcess($arguments = array(), $options = array()) { $q = Doctrine_Core::getTable('myProfile') ->createQuery('c') ->leftJoin('c.User u'); //->select('c.*'); $all = $q->execute(); $this->logSection('', $all->count() ); foreach( $all as $profile ) { $this->logSection('-', $profile ); $person = new dsPerson(); $person->firstname = $profile->getFirstName(); $person->lastname = $profile->getLastName(); $person->email = $profile->getUser()->getEmailAddress(); $person->street = $profile->getStreet(); $person->city = $profile->getCity(); $person->postalcode = $profile->getZipCode(); $person->phone = $profile->getPhone(); $person->birthday = $this->makeDate( $profile->getDateOfBirth() ); $person->gender = $profile->getGender() == 'm' ? 'male' : 'female'; $person->user_id = $profile->user_id; $person->save(); // break; } }
public function enroll(dsPerson $person, $role, $registration = null, $partner = null, $confirm = true, $type = 'regular') { $enrolment = new dsClassStudent(); $enrolment->link('Class', $this->getId() ); $enrolment->link('Person', $person->getId()); $enrolment->setRole( $role ); $enrolment->setPartner( $partner ); if (!is_null($registration)) { $enrolment->link('Registration', $registration); $registration->approve(); $registration->save(); } else { $enrolment->link('Registration', NULL); // $enrolment->registration_id = NULL; } if ($confirm) $enrolment->setDateConfirmed( date('Y-m-d H:i:s', time()) ); // $conn->setAttribute(Doctrine_Core::ATTR_CASCADE_SAVES, false); // $enrolment->link('Registration', NULL); // $enrolment->unlink('Registration'); // 2013-02-04 $enrolment->setType( $type ); try { $enrolment->save(); return $enrolment; } catch (Exception $e) { return false; } //$enrolment->confirm(); // 2. send email // $this->sendConfirmationEmail(); // return $enrolment; // dsClassStudent }