function createBarn($eventId, $name) { $event = new Event($eventId); if ($event->GetEvent() == null) { throw new Exception('Invalid event id.'); exit; } $barn = R::dispense(BARN); $barn->name = $name; $id = R::store($barn); if ($event->AddBarn($barn) < 0) { throw new Exception('Could not add barn to event.'); exit; } $event->Save(); return $id; }
function createDivision($eventId, $name) { $event = new Event($eventId); if ($event->GetEvent() == null) { throw new Exception('Invalid event id.'); exit; } $division = R::dispense(DIVISION); $division->name = $name; $id = R::store($division); if ($id <= 0) { throw new Exception('Could not store division.'); exit; } if ($event->AddDivision($division) < 0) { throw new Exception('Could not add division to event.'); exit; } $event->Save(); return $id; }