mirror of
https://github.com/flarum/core.git
synced 2025-07-25 02:31:17 +02:00
Gracefully handle discussions with no posts
Although this should never happen
This commit is contained in:
@@ -58,7 +58,7 @@ abstract class BaseSerializer extends SerializerAbstract
|
||||
$data = $model->getRelation($relation);
|
||||
} elseif ($many) {
|
||||
$relationIds = $relation.'_ids';
|
||||
$data = $model->$relationIds ?: $model->$relation()->lists('id');
|
||||
$data = isset($model->$relationIds) ? $model->$relationIds : $model->$relation()->lists('id');
|
||||
} else {
|
||||
$relationId = $relation.'_id';
|
||||
$data = $model->$relationId;
|
||||
|
Reference in New Issue
Block a user