]> BookStack Code Mirror - bookstack/blobdiff - app/References/ReferenceFetcher.php
ZIP Imports: Added API examples, finished testing
[bookstack] / app / References / ReferenceFetcher.php
index 0d9883a3edcbcc057136a3273cd5433055286f55..1c9664f45a9979d8c5e88627b4bb6eaa7547dd1a 100644 (file)
@@ -23,7 +23,7 @@ class ReferenceFetcher
     public function getReferencesToEntity(Entity $entity): Collection
     {
         $references = $this->queryReferencesToEntity($entity)->get();
-        $this->mixedEntityListLoader->loadIntoRelations($references->all(), 'from');
+        $this->mixedEntityListLoader->loadIntoRelations($references->all(), 'from', true);
 
         return $references;
     }
@@ -41,7 +41,8 @@ class ReferenceFetcher
     {
         $baseQuery = Reference::query()
             ->where('to_type', '=', $entity->getMorphClass())
-            ->where('to_id', '=', $entity->id);
+            ->where('to_id', '=', $entity->id)
+            ->whereHas('from');
 
         return $this->permissions->restrictEntityRelationQuery(
             $baseQuery,