Skip to content
Snippets Groups Projects
Commit 7a94c0e4 authored by Marcus Eibrink-Lunzenauer's avatar Marcus Eibrink-Lunzenauer
Browse files

Defend against missing home institutes.

Closes #443.
parent d821f486
No related branches found
No related tags found
No related merge requests found
......@@ -89,11 +89,15 @@ class Course extends SchemaProvider
*/
private function getInstitute(\Course $course, $shouldInclude)
{
return [
self::RELATIONSHIP_LINKS => [
Link::RELATED => $this->createLinkToResource($course->home_institut),
],
self::RELATIONSHIP_DATA => $course->home_institut,
return $course->institut_id
? [
self::RELATIONSHIP_LINKS => [
Link::RELATED => $this->createLinkToResource($course->home_institut),
],
self::RELATIONSHIP_DATA => $course->home_institut,
]
: [
self::RELATIONSHIP_DATA => null,
];
}
......
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