Merge pull request #5014 from christianbeeznest/ofaj-21219-2

Session: Fix error when session is created and visibility - refs BT#21219
pull/5020/head
christianbeeznest 12 months ago committed by GitHub
commit 75a43c963b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      public/main/session/session_add.php
  2. 11
      src/CoreBundle/Entity/Course.php

@ -253,9 +253,9 @@ $form->setDefaults($formDefaults);
if ($form->validate()) { if ($form->validate()) {
$params = $form->getSubmitValues(); $params = $form->getSubmitValues();
$name = $params['name']; $name = $params['name'];
$startDate = $params['access_start_date2']; $startDate = $params['access_start_date'];
$endDate = $params['access_end_date']; $endDate = $params['access_end_date'];
$displayStartDate = $params['display_start_date2']; $displayStartDate = $params['display_start_date'];
$displayEndDate = $params['display_end_date']; $displayEndDate = $params['display_end_date'];
$coachStartDate = $params['coach_access_start_date']; $coachStartDate = $params['coach_access_start_date'];
if (empty($coachStartDate)) { if (empty($coachStartDate)) {

@ -550,10 +550,15 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith
public function getTeachersSubscriptions(): Collection public function getTeachersSubscriptions(): Collection
{ {
$criteria = Criteria::create(); $teacherSubscriptions = new ArrayCollection();
$criteria->where(Criteria::expr()->eq('status', CourseRelUser::TEACHER));
return $this->users->matching($criteria); foreach ($this->users as $subscription) {
if ($subscription->getStatus() === CourseRelUser::TEACHER) {
$teacherSubscriptions->add($subscription);
}
}
return $teacherSubscriptions;
} }
public function addUserAsTeacher(User $user): self public function addUserAsTeacher(User $user): self

Loading…
Cancel
Save