1
0
mirror of https://github.com/flarum/core.git synced 2025-07-31 13:40:20 +02:00

Clean up model custom relation functionality

This commit is contained in:
Toby Zerner
2015-07-01 13:22:09 +09:30
parent 094825792a
commit eafdd415ef
3 changed files with 65 additions and 76 deletions

View File

@@ -11,6 +11,7 @@ use Flarum\Core\Models\User;
class Discussion extends Model
{
use EventGenerator;
use Locked;
use VisibleScope;
@@ -369,7 +370,7 @@ class Discussion extends Model
// Unfortunately we can't check to see if the user ID is the same,
// because the user may not have a state entry, in which case the loaded
// relation will be null.
if ($this->isRelationLoaded('state')) {
if (array_key_exists('state', $this->relations)) {
return $this->relations['state'];
}