I've a problem with datarelations.
On my page I've some Events that each Member can sing up to. The problem is that the member has to be able to choose what to drink and eat for each Event. I've tried to solve it using an extra dataobject called Participant like this
EventPage
many_many: Participant
Participant
Has_many: EventPage
Has_one: Member
Member
has_one: Participant
Each member can sing up to the event through a form on the event-page.
The problem is that I dont know how to save the information in the correct way.
File: EventPage
$p = new Participant();
if(isset($data['toDrink'])) {
$p->Drink = $data['toDrink'];
}
if(isset($data['Vegetarian'])) {
$p->Vegetarian = $data['Vegetarian'];
}
$p->Member = Member::CurrentUser();
$e = $p->Events();
$e->add($this);
$p->write();
$existingParticipants = $this->Participants();
$existingParticipants->add($p);
The fields
- Member.ParticipantID
- Participant.MemberID
and the table
- Participant_Events
is still empty after the member has signup => The member doesnt get signed up..