Skip to content

Commit

Permalink
[BUGFIX] Fix for $documentArray being null after function `getDoc…
Browse files Browse the repository at this point in the history
…umentById` is called (#1345)

Co-authored-by: Sebastian Meyer <[email protected]>
  • Loading branch information
beatrycze-volk and sebastian-meyer committed Oct 10, 2024
1 parent ffc9866 commit fdc2975
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Classes/Controller/AbstractController.php
Original file line number Diff line number Diff line change
Expand Up @@ -508,11 +508,14 @@ protected function buildSimplePagination(PaginationInterface $pagination, Pagina
*/
private function getDocumentByUid(int $documentId)
{
// TODO: implement multiView as it is in getDocumentByUrl
$doc = null;
$this->document = $this->documentRepository->findOneByIdAndSettings($documentId);

if ($this->document) {
$doc = AbstractDocument::getInstance($this->document->getLocation(), $this->settings, true);
// fix for count(): Argument #1 ($value) must be of type Countable|array, null given
$this->documentArray[] = $doc;
} else {
$this->logger->error('Invalid UID "' . $documentId . '" or PID "' . $this->settings['storagePid'] . '" for document loading');
}
Expand Down

0 comments on commit fdc2975

Please sign in to comment.