Project

General

Profile

Actions

Feature #97689

open

Resolve file relation on JsonView configuration

Added by Aristeidis Karavas over 2 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Extbase
Start date:
2022-05-25
Due date:
% Done:

0%

Estimated time:
PHP Version:
7.4
Tags:
extbase, JsonView
Complexity:
Sprint Focus:

Description

I recently created a headless project. For the project i used the news extension as well. With the help of the PSR-14, i got the news entries on my listener class. I wanted to convert the object to array because headless does not support extbase object, only json. I managed to convert everything to array with the following configuration:

$this->view->setConfiguration([
    'news' => [
        '_descendAll' => [
            '_recursive' => ['categories', 'falMedia', 'contentElements', 'tags']
         ],
     ]
]);

Everything worked fine until i saw the falMedia object. It resolved the sys_file_reference, meaning it found the file, but it didnt retrieve the object, instead it returned the UID of the file. This is what i got:

falMedia": {
  "0000000018019f7e000000007283656b": {
  "alternative": "",
  "description": "",
  "fileUid": 8,
  "link": "",
  "pid": 37,
  "showinpreview": 0,
  "title": "",
  "uid": 93
  }
},

The UID is the sys_file_reference id and the fileUid is the file id in the sys_file table.

AFAIK there is not a function implemented that does just that (i looked inside the JsonView class) so it would be great if that can be possible in the future


Files

Screenshot 2022-05-25 at 13.45.38.png (32.3 KB) Screenshot 2022-05-25 at 13.45.38.png Aristeidis Karavas, 2022-05-25 11:45

No data to display

Actions

Also available in: Atom PDF