Fix param type in AddCourse::insertExampleContent

pull/6032/head
Angel Fernando Quiroz Campos 10 months ago
parent a610fd6c7f
commit 4748473a31
No known key found for this signature in database
GPG Key ID: B284841AE3E562CD
  1. 11
      public/main/inc/lib/add_course.lib.inc.php

@ -244,15 +244,14 @@ class AddCourse
*/ */
public static function fillCourse(Course $course, bool $fillWithExemplaryContent = null, int $authorId = 0): bool public static function fillCourse(Course $course, bool $fillWithExemplaryContent = null, int $authorId = 0): bool
{ {
$entityManager = Database::getManager();
$authorId = $authorId ?: api_get_user_id(); $authorId = $authorId ?: api_get_user_id();
self::insertCourseSettings($course); self::insertCourseSettings($course);
self::createGroupCategory($course); self::createGroupCategory($course);
$gradebook = self::createRootGradebook($course);
if ($fillWithExemplaryContent ?? api_get_setting('example_material_course_creation') !== 'false') { if ($fillWithExemplaryContent ?? api_get_setting('example_material_course_creation') !== 'false') {
self::insertExampleContent($course, $authorId, $entityManager); $gradebook = self::createRootGradebook($course);
self::insertExampleContent($course, $authorId, $gradebook);
} }
self::installCoursePlugins($course->getId()); self::installCoursePlugins($course->getId());
@ -362,12 +361,12 @@ class AddCourse
* *
* @param Course $course The course object into which the example content will be inserted. * @param Course $course The course object into which the example content will be inserted.
* @param int $authorId The ID of the user who will be listed as the author of the inserted content. * @param int $authorId The ID of the user who will be listed as the author of the inserted content.
* @param GradebookCategory $gradebook * @param GradebookCategory|null $gradebook
* *
* @return void * @return void
* @throws Exception * @throws Exception
*/ */
private static function insertExampleContent(Course $course, int $authorId, GradebookCategory $gradebook): void private static function insertExampleContent(Course $course, int $authorId, ?GradebookCategory $gradebook): void
{ {
$now = api_get_utc_datetime(); $now = api_get_utc_datetime();
$files = [ $files = [

Loading…
Cancel
Save