getQueriesForType($entityType); return $queries->findVisibleById($entityId); } /** * Start a query of visible entities of the given type, * suitable for listing display. */ public function visibleForList(string $entityType): Builder { $queries = $this->getQueriesForType($entityType); return $queries->visibleForList(); } protected function getQueriesForType(string $type): ProvidesEntityQueries { /** @var ?ProvidesEntityQueries $queries */ $queries = match ($type) { 'page' => $this->pages, 'chapter' => $this->chapters, 'book' => $this->books, 'bookshelf' => $this->shelves, default => null, }; if (is_null($queries)) { throw new InvalidArgumentException("No entity query class configured for {$type}"); } return $queries; } }