X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/a6633642232efd164d4708967ab59e498fbff896..refs/pull/3298/head:/app/Entities/Tools/SiblingFetcher.php diff --git a/app/Entities/Tools/SiblingFetcher.php b/app/Entities/Tools/SiblingFetcher.php index 6964fa2e6..617ef4a62 100644 --- a/app/Entities/Tools/SiblingFetcher.php +++ b/app/Entities/Tools/SiblingFetcher.php @@ -1,35 +1,38 @@ -get($entityType)->visible()->findOrFail($entityId); + $entity = (new EntityProvider())->get($entityType)->visible()->findOrFail($entityId); $entities = []; // Page in chapter - if ($entity->isA('page') && $entity->chapter) { + if ($entity instanceof Page && $entity->chapter) { $entities = $entity->chapter->getVisiblePages(); } // Page in book or chapter - if (($entity->isA('page') && !$entity->chapter) || $entity->isA('chapter')) { + if (($entity instanceof Page && !$entity->chapter) || $entity instanceof Chapter) { $entities = $entity->book->getDirectChildren(); } // Book // Gets just the books in a shelf if shelf is in context - if ($entity->isA('book')) { - $contextShelf = (new ShelfContext)->getContextualShelfForBook($entity); + if ($entity instanceof Book) { + $contextShelf = (new ShelfContext())->getContextualShelfForBook($entity); if ($contextShelf) { $entities = $contextShelf->visibleBooks()->get(); } else { @@ -37,8 +40,8 @@ class SiblingFetcher } } - // Shelve - if ($entity->isA('bookshelf')) { + // Shelf + if ($entity instanceof Bookshelf) { $entities = Bookshelf::visible()->get(); }