Example #1
0
 public function insert(Connection $conn)
 {
     $this->createdAt = time();
     $this->accessKey = sha1(uniqid(\microtime() . $this->lastName . $this->whyParticipate, true));
     $conn->insert(EdkTables::PARTICIPANT_TBL, DataMappers::pick($this, ['accessKey', 'firstName', 'lastName', 'sex', 'age', 'email', 'peopleNum', 'customAnswer', 'whyParticipate', 'howManyTimes', 'whereLearnt', 'whereLearntOther', 'terms1Accepted', 'terms2Accepted', 'terms3Accepted', 'createdAt', 'ipAddress'], ['routeId' => $this->registrationSettings->getRoute()->getId(), 'areaId' => $this->registrationSettings->getRoute()->getArea()->getId()]));
     $this->id = $conn->lastInsertId();
     $this->registrationSettings->registerParticipant($conn, $this);
     return $this->id;
 }