Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TYPO3 12: RelatedModuleViewHelper access to non existing variable $relations #47

Open
3l73 opened this issue Oct 4, 2024 · 0 comments

Comments

@3l73
Copy link

3l73 commented Oct 4, 2024

The ViewHelper RelatedModuleViewHelper uses the variable $relations to retrieve relations.

In case of exceptions the variable is not set which can leads to errors or at least warnings.

$variableProvider->add('relations', $relations['result']);

The variable should be initialized in order to avoid warnings.

   $relations = [
       'result' => [].
   ];
    try {
      // Make an attempt with the FIRST configured dimension mapping enabled. The first entry SHOULD always be the default language.
      $fieldValue = (new ResponseDataFieldValueReader())->readResponseDataField($response['result'][0], $field, $module->getServer()->getDimensionMappings()->current());
      if ($fieldValue != null) {
        $relations = ['result' => (array)$fieldValue];
        if ($arguments['verifyRelations']) {
          $relations = $module->getServer()->getClient()->getBeans($fieldValue, $relatedModule->getConnectorName());
        }
      }
    } catch (\RuntimeException $error) {
      $fieldValue = $error->getMessage();
    } catch (PropertyNotAccessibleException $error) {
      $fieldValue = $error->getMessage();
    }
@3l73 3l73 changed the title TYPO3 12: RelatedModuleViewHelper acces to non existing variable $relations TYPO3 12: RelatedModuleViewHelper access to non existing variable $relations Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant