Skip to content
Snippets Groups Projects
Commit fe83b82f authored by Tobias Gross-Vogt's avatar Tobias Gross-Vogt
Browse files

#28178 filter paramters instead of subressource, fixed array intersection

parent 8c24b002
No related branches found
No related tags found
No related merge requests found
Pipeline #94346 passed
......@@ -48,7 +48,9 @@ final class CourseCollectionDataProvider extends AbstractController implements C
if (!empty($personId)) {
$coursesByPerson = $this->courseProvider->getCoursesByPerson($personId, $options);
if (!empty($organizationId)) {
$courses = array_uintersect($courses, $coursesByPerson, compareCourses);
$courses = array_uintersect($courses, $coursesByPerson,
'Dbp\Relay\BaseCourseBundle\DataProvider\CourseCollectionDataProvider::compareCourses');
$courses = array_values($courses);
} else {
$courses = $coursesByPerson;
}
......@@ -70,11 +72,11 @@ final class CourseCollectionDataProvider extends AbstractController implements C
return new ArrayFullPaginator($courses, $page, $perPage);
}
private static function compareCourses(Course $a, Course $b): int
public static function compareCourses(Course $a, Course $b): int
{
if ($a->getIdentifier() > $b->getIdentifier()) {
return 1;
} else if ($a->getIdentifier() === $b->getIdentifier()) {
} elseif ($a->getIdentifier() === $b->getIdentifier()) {
return 0;
} else {
return -1;
......
......@@ -5,8 +5,6 @@ declare(strict_types=1);
namespace Dbp\Relay\BaseCourseBundle\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use Dbp\Relay\BaseCourseBundle\Controller\GetCoursesByOrganization;
use Dbp\Relay\BaseCourseBundle\Controller\GetCoursesByPerson;
use Symfony\Component\Serializer\Annotation\Groups;
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment