Beispiel #1
0
 public function remove(Connection $conn)
 {
     $this->areaNum = $conn->fetchColumn('SELECT `areaNum` FROM `' . CoreTables::TERRITORY_TBL . '` WHERE `id` = :id', [':id' => $this->id]);
     if ($this->canRemove()) {
         $conn->delete(CoreTables::TERRITORY_TBL, DataMappers::pick($this, ['id']));
         return true;
     }
     return false;
 }
Beispiel #2
0
 public function remove(Connection $conn)
 {
     $conn->delete(CoreTables::LANGUAGE_TBL, DataMappers::pick($this, ['id']));
 }
Beispiel #3
0
 public function remove(Connection $conn)
 {
     $conn->delete(LinksTables::LINK_TBL, DataMappers::pick($this, ['id']));
 }
Beispiel #4
0
 public function update(Connection $conn)
 {
     $groupName = null;
     if (null !== $this->group) {
         $groupName = $this->group->getName();
     }
     if (!DataMappers::same($this->oldGroup, $this->group)) {
         DataMappers::recount($conn, CoreTables::GROUP_TBL, $this->oldGroup, $this->group, 'areaNum', 'id');
     }
     if (!DataMappers::same($this->oldStatus, $this->status)) {
         DataMappers::recount($conn, CoreTables::AREA_STATUS_TBL, $this->oldStatus, $this->status, 'areaNum', 'id');
     }
     if (!DataMappers::same($this->oldTerritory, $this->territory)) {
         DataMappers::recount($conn, CoreTables::TERRITORY_TBL, $this->oldTerritory, $this->territory, 'areaNum', 'id');
     }
     $this->entity->setName($this->name);
     $this->entity->update($conn);
     $this->lastUpdatedAt = time();
     return $conn->update(CoreTables::AREA_TBL, DataMappers::pick($this, ['name', 'group', 'territory', 'status', 'lastUpdatedAt', 'percentCompleteness'], ['customData' => json_encode($this->customData), 'groupName' => $groupName]), DataMappers::pick($this, ['id']));
 }
Beispiel #5
0
 public function remove(Connection $conn)
 {
     $this->removedAt = time();
     return $conn->update(CoreTables::ENTITY_TBL, DataMappers::pick($this, ['removedAt']), DataMappers::pick($this, ['id']));
 }
Beispiel #6
0
 public function update(Connection $conn)
 {
     $conn->update(EdkTables::PARTICIPANT_TBL, DataMappers::pick($this, ['firstName', 'lastName', 'sex', 'age', 'email', 'peopleNum', 'customAnswer', 'whyParticipate', 'howManyTimes', 'whereLearnt', 'whereLearntOther']), ['id' => $this->id]);
 }
Beispiel #7
0
 public function remove(Connection $conn)
 {
     $conn->delete(CoreTables::USER_REGISTRATION_TBL, DataMappers::pick($this, ['id']));
 }
Beispiel #8
0
 public function updateSettings(Connection $conn)
 {
     $conn->update(CoreTables::USER_PROFILE_TBL, DataMappers::pick($this, ['settingsLanguage', 'settingsTimezone']), ['userId' => $this->getId()]);
 }
Beispiel #9
0
 public function remove(Connection $conn)
 {
     $conn->delete(ExportTables::DATA_EXPORT_TBL, DataMappers::pick($this, ['id']));
 }
Beispiel #10
0
 public function remove(Connection $conn)
 {
     $conn->delete(CoreTables::AREA_STATUS_TBL, DataMappers::pick($this, ['id']));
 }
Beispiel #11
0
 public function remove(Connection $conn)
 {
     $this->status = $conn->fetchColumn('SELECT `status` FROM `' . CoreTables::AREA_REQUEST_TBL . '` WHERE `id` = :id', [':id' => $this->id]);
     if ($this->canRemove()) {
         DataMappers::recount($conn, CoreTables::TERRITORY_TBL, $this->territory, null, 'requestNum', 'id');
         $conn->delete(CoreTables::AREA_REQUEST_TBL, DataMappers::pick($this, ['id']));
     }
 }
Beispiel #12
0
 public function remove(Connection $conn)
 {
     $conn->delete(EdkTables::ROUTE_TBL, DataMappers::pick($this, ['id']));
 }
Beispiel #13
0
 public function update(Connection $conn)
 {
     $this->entity->setName($this->name);
     $this->entity->update($conn);
     return $conn->update(CoreTables::PROJECT_TBL, DataMappers::pick($this, ['name', 'description', 'parentProject', 'areasAllowed', 'areaRegistrationAllowed', 'archived', 'archivedAt'], ['modules' => implode(',', $this->getModules())]), DataMappers::pick($this, ['id']));
 }
Beispiel #14
0
 public function remove(Connection $conn)
 {
     $conn->delete(MilestoneTables::MILESTONE_RULE_TBL, DataMappers::pick($this, ['id']));
 }
Beispiel #15
0
 public function changeState(Connection $conn)
 {
     $conn->update(EdkTables::MESSAGE_TBL, DataMappers::pick($this, ['status', 'answeredAt', 'completedAt', 'responder', 'duplicate']), ['id' => $this->id]);
 }
Beispiel #16
0
 public function insert(Connection $conn)
 {
     if (null !== $this->getId()) {
         throw new LogicException('Cannot perform insert() on a persisted Course instance.');
     }
     $this->lastUpdated = time();
     $conn->insert(CourseTables::COURSE_TBL, DataMappers::pick($this, ['name', 'description', 'project', 'authorName', 'authorEmail', 'lastUpdated', 'presentationLink', 'deadline', 'isPublished', 'displayOrder', 'notes']));
     $this->setId($conn->lastInsertId());
     if ($this->getPublished()) {
         $this->incrementMandatoryCourses($conn);
     }
     return $this->getId();
 }
Beispiel #17
0
 public function remove(Connection $conn)
 {
     if ($this->canRemove()) {
         $this->entity->remove($conn);
         $conn->delete(CoreTables::GROUP_TBL, DataMappers::pick($this, ['id']));
     }
 }
Beispiel #18
0
 public function remove(Connection $conn)
 {
     $conn->delete(CoreTables::GROUP_CATEGORY_TBL, DataMappers::pick($this, ['id']));
 }
 public function update(Connection $conn)
 {
     if ($this->isNew) {
         $conn->insert(EdkTables::REGISTRATION_SETTINGS_TBL, DataMappers::pick($this, ['route', 'registrationType', 'startTime', 'endTime', 'externalRegistrationUrl', 'participantLimit', 'allowLimitExceed', 'maxPeoplePerRecord', 'externalParticipantNum', 'customQuestion'], ['areaId' => $this->route->getArea()->getId()]));
     } else {
         $conn->update(EdkTables::REGISTRATION_SETTINGS_TBL, DataMappers::pick($this, ['registrationType', 'startTime', 'endTime', 'externalRegistrationUrl', 'participantLimit', 'allowLimitExceed', 'maxPeoplePerRecord', 'externalParticipantNum', 'customQuestion']), ['routeId' => $this->route->getId()]);
     }
     $conn->update(EdkTables::ROUTE_TBL, ['updatedAt' => time()], ['id' => $this->route->getId()]);
     return $this->route->getId();
 }