X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/876bc10d4d414c0680ea13e008b764c3ee70060f..refs/pull/3113/head:/app/Entities/Models/Entity.php diff --git a/app/Entities/Models/Entity.php b/app/Entities/Models/Entity.php index eccec40b5..0eb402284 100644 --- a/app/Entities/Models/Entity.php +++ b/app/Entities/Models/Entity.php @@ -121,11 +121,11 @@ abstract class Entity extends Model implements Sluggable, Favouritable, Viewable return true; } - if (($entity->isA('chapter') || $entity->isA('page')) && $this->isA('book')) { + if (($entity instanceof BookChild) && $this instanceof Book) { return $entity->book_id === $this->id; } - if ($entity->isA('page') && $this->isA('chapter')) { + if ($entity instanceof Page && $this instanceof Chapter) { return $entity->chapter_id === $this->id; } @@ -211,6 +211,7 @@ abstract class Entity extends Model implements Sluggable, Favouritable, Viewable /** * Check if this instance or class is a certain type of entity. * Examples of $type are 'page', 'book', 'chapter'. + * * @deprecated Use instanceof instead. */ public static function isA(string $type): bool