kitodo/kitodo-presentation

Calendar View does not work

Closed this issue · 0 comments

Description

Calender view does not work.

Two errors are responsible for this:

The location of the first error describes @beatrycze-volk in slub/dfg-viewer#259 (comment)

As I described in slub/dfg-viewer#259 (comment), you can avoid the error by inserting the following 3 lines

$objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\Extbase\\Object\\ObjectManager');
$configurationManager = $objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager');
$this->injectConfigurationManager($configurationManager);

before

$frameworkConfiguration = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);

The second error becomes visible after this correction.
If you click on a year in the year overview of a newspaper, the following error message is displayed:

Fatal error: Uncaught TypeError: Argument 1 passed to Kitodo\Dlf\Controller\CalendarController::getIssuesFromDocuments() must be of the type array, object given, called in /var/www/typo3/packages/bfallert/presentation/Classes/Controller/CalendarController.php on line 439 and defined in /var/www/typo3/packages/bfallert/presentation/Classes/Controller/CalendarController.php:489 Stack trace: #0 /var/www/typo3/packages/bfallert/presentation/Classes/Controller/CalendarController.php(439): Kitodo\Dlf\Controller\CalendarController->getIssuesFromDocuments() #1 /var/www/typo3/packages/bfallert/presentation/Classes/Controller/CalendarController.php(400): Kitodo\Dlf\Controller\CalendarController->getIssues() #2 /var/www/typo3/packages/bfallert/presentation/Classes/Controller/CalendarController.php(362): Kitodo\Dlf\Controller\CalendarController->getIssuesByYear() #3 /var/www/typo3/packages/bfallert/presentation/Classes/Controller/CalendarController.php(115): Kitodo\Dlf\Controller\CalendarController->buildCalendar() #4 /var/www/typo3/ in /var/www/typo3/packages/bfallert/presentation/Classes/Controller/CalendarController.php on line 489

The type of the parameter $documents is not a array, but an object.

Reproduction

Steps to reproduce the behaviour:

  1. Add in
    $frameworkConfiguration = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
    the fix described in slub/dfg-viewer#259 (comment)
  2. open a Newspager
  3. Get the year overview
  4. Click on a year
  5. Get the error

Expected Behavior

A Calender View shout be opened

image

Screenshots and Examples

year overview of a newspaper

image

Additional Context

The Problem comes from the the line

private function getIssuesFromDocuments(array $documents): array

the type of the parameter $documents is not a array, but an object. If i remove the type "array", everythin works fine, i.e. I get the calender view.