public function __construct(Course $course) { $details = []; $details['id'] = $course->getId(); $details['title'] = $course->getTitle(); $details['code'] = $course->getCode(); $details['publicRegistration'] = $course->getPublicRegistration(); $details['publicUnregistration'] = $course->getPublicUnregistration(); $details['registrationValidation'] = $course->getRegistrationValidation(); $details['icon'] = $course->getIcon(); $details['tutorRoleName'] = $course->getTutorRoleName(); $details['learnerRoleName'] = $course->getLearnerRoleName(); $details['userValidation'] = $course->getUserValidation(); $details['organizationValidation'] = $course->getOrganizationValidation(); $details['maxUsers'] = $course->getMaxUsers(); $details['defaultSessionDuration'] = $course->getDefaultSessionDuration(); $details['withSessionEvent'] = $course->getWithSessionEvent(); $workspace = $course->getWorkspace(); $workspaceModel = $course->getWorkspaceModel(); if (!is_null($workspace)) { $details['workspaceId'] = $workspace->getId(); $details['workspaceName'] = $workspace->getName(); $details['workspaceCode'] = $workspace->getCode(); $details['workspaceGuid'] = $workspace->getGuid(); } if (!is_null($workspaceModel)) { $details['workspaceModelId'] = $workspaceModel->getId(); $details['workspaceModelName'] = $workspaceModel->getName(); } parent::__construct(self::ACTION, $details); }
public function deleteCourse(Course $course) { $details = []; $details['id'] = $course->getId(); $details['title'] = $course->getTitle(); $details['code'] = $course->getCode(); $details['publicRegistration'] = $course->getPublicRegistration(); $details['publicUnregistration'] = $course->getPublicUnregistration(); $details['registrationValidation'] = $course->getRegistrationValidation(); $details['icon'] = $course->getIcon(); $details['tutorRoleName'] = $course->getTutorRoleName(); $details['learnerRoleName'] = $course->getLearnerRoleName(); $details['userValidation'] = $course->getUserValidation(); $details['organizationValidation'] = $course->getOrganizationValidation(); $details['maxUsers'] = $course->getMaxUsers(); $details['defaultSessionDuration'] = $course->getDefaultSessionDuration(); $details['withSessionEvent'] = $course->getWithSessionEvent(); $workspace = $course->getWorkspace(); $workspaceModel = $course->getWorkspaceModel(); if (!is_null($workspace)) { $details['workspaceId'] = $workspace->getId(); $details['workspaceName'] = $workspace->getName(); $details['workspaceCode'] = $workspace->getCode(); $details['workspaceGuid'] = $workspace->getGuid(); } if (!is_null($workspaceModel)) { $details['workspaceModelId'] = $workspaceModel->getId(); $details['workspaceModelName'] = $workspaceModel->getName(); } $this->om->remove($course); $this->om->flush(); $event = new LogCourseDeleteEvent($details); $this->eventDispatcher->dispatch('log', $event); }