mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-22 04:58:01 +01:00
Null handling of soft deleted tracks for favourites page
This commit is contained in:
parent
d054bb4a34
commit
8f71b408ef
1 changed files with 10 additions and 2 deletions
|
@ -91,8 +91,11 @@ class Favourite extends Model
|
||||||
} else {
|
} else {
|
||||||
if ($this->playlist_id) {
|
if ($this->playlist_id) {
|
||||||
return $this->playlist;
|
return $this->playlist;
|
||||||
} // no resource - this should never happen under real circumstances
|
}
|
||||||
else {
|
else {
|
||||||
|
// No resource
|
||||||
|
// In this case, either the resource was
|
||||||
|
// soft-deleted or something else occurred.
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,6 +104,11 @@ class Favourite extends Model
|
||||||
|
|
||||||
public function getTypeAttribute()
|
public function getTypeAttribute()
|
||||||
{
|
{
|
||||||
return get_class($this->resource);
|
// As of PHP 7.2, get_class is picky about null args
|
||||||
|
if ($resource = $this->resource) {
|
||||||
|
return get_class($resource);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue