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

[FEATURE] TYPO3 v12 reactions support #107

Merged
merged 89 commits into from
Nov 1, 2023
Merged

[FEATURE] TYPO3 v12 reactions support #107

merged 89 commits into from
Nov 1, 2023

Conversation

mabolek
Copy link
Contributor

@mabolek mabolek commented Sep 13, 2023

The implementation uses the new core extension "reactions" and is similar to a normal REST request, except from:

  • The entry point is always the reaction extension's entry point: /typo3/reaction/{reactionId}
  • Backend user authentication is handled by the reactions extension.
  • The HTTP method of a reaction request must always be POST, so you must instead provide the action in the JSON array key method (POST, PUT, PATCH, or DELETE).
  • table, remoteId, language, and workspace can only be supplied in the JSON array.

Removes compatibility code for versions below v11 and upgrades composer dependencies.
It is now possible to configure how empty files are handled. The extension configuration property `handleEmptyFile` can be set to these values:

0: Treat as any other file. You can also use this option if you want to handle empty files with a custom `Pixelant\Interest\DataHandling\Operation\Event\BeforeRecordOperationEvent`. Just make sure your EventHandler it is executed after `\Pixelant\Interest\DataHandling\Operation\Event\Handler\PersistFileDataEventHandler`.

1: Stop processing the record. This might result in pending relation records that will never be resolved in the database, but if that's OK for you it won't cause any issues.

2: Fail. The operation will be treated as failed and returns an error.
Removes compatibility code for versions below v11 and upgrades composer dependencies.
It is now possible to configure how empty files are handled. The extension configuration property `handleEmptyFile` can be set to these values:

0: Treat as any other file. You can also use this option if you want to handle empty files with a custom `Pixelant\Interest\DataHandling\Operation\Event\BeforeRecordOperationEvent`. Just make sure your EventHandler it is executed after `\Pixelant\Interest\DataHandling\Operation\Event\Handler\PersistFileDataEventHandler`.

1: Stop processing the record. This might result in pending relation records that will never be resolved in the database, but if that's OK for you it won't cause any issues.

2: Fail. The operation will be treated as failed and returns an error.
Use `getDataForDataHandler()` and `setDataForDataHandler()` instead.
The HTTP request body was previously first parsed into objects and then converted to an array. This was done to be able to detect the difference between record data and nested table/recordId/language/workspace arrays. This can instead be implemented using `array_is_list()`. `symfony/polyfill-php81` provides a polyfill for PHP versions below 8.1.

This commit also adds an optional third parameter, `?array $parsedBody = null`, to  `\Pixelant\Interest\RequestHandler\AbstractRecordRequestHandler::__construct()`. This parameter makes it possible to supply a parsed JSON body as associative array to avoid parsing JSON twice.
The implementation uses the new core extension "reactions" and is similar to a normal REST request, except from:

* The entry point is always the reaction extension's entry point: `/typo3/reaction/{reactionId}`
* Backend user authentication is handled by the reactions extension.
* The HTTP method of a reaction request must always be POST, so you must instead provide the action in the JSON array key `method` (POST, PUT, PATCH, or DELETE).
* `table`, `remoteId`, `language`, and `workspace` can only be supplied in the JSON array.
@mabolek mabolek self-assigned this Sep 13, 2023
Outputs error identifiers.
UpdateRecordOperationTest has been updated so $imageUpdates is no longer overwritten in the foreach loop.

Fixes #103
* Rename `$decodedContent` to `$parsedBody`
* Correctly set metadata
* Throw exception on JSON decode error
* Fetch and parse request body in separate method
UpdateRecordOperationTest has been updated so $imageUpdates is no longer overwritten in the foreach loop.

Fixes #103
No operations were requested and none executed.
Also introduces additional requirements as a way to install and test possible/suggested requirements.
@mabolek mabolek changed the title [WIP][FEATURE] TYPO3 v12 reactions support [FEATURE] TYPO3 v12 reactions support Nov 1, 2023
Copy link
Contributor

@MattiasNilsson MattiasNilsson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome feature 👍

Base automatically changed from typo3v12-array-is-list to master November 1, 2023 09:06
@mabolek mabolek merged commit 21123fa into master Nov 1, 2023
13 checks passed
@mabolek mabolek deleted the typo3v12-reactions branch November 1, 2023 09:08
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

Successfully merging this pull request may close these issues.

2 participants