Commit 1a7f73a0 authored by Kevin von Spiczak's avatar Kevin von Spiczak
Browse files

[BUGFIX] fix typeError in hook

This commit fixes the following Exception: Argument 3 passed to SGalinski\SgMail\Hooks\ProcessDatamap::processDatamap_afterDatabaseOperations() must be of the type int, string given, called in /var/www/softingit.dev/web/typo3/sysext/core/Classes/DataHandling/DataHandler.php on line 855
The exception was thrown when creating a new translation of a page.
parent 552bf4cb
<?php
namespace SGalinski\SgMail\Hooks;
/***************************************************************
* Copyright notice
*
......@@ -23,15 +26,17 @@
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
namespace SGalinski\SgMail\Hooks;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\DataHandling\DataHandler;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
/**
* Class ProcessDatamap
* Hooks for synchronize urls directly on-the-fly while editing
*
* @package SGalinski\SgMail\Hooks
*/
class ProcessDatamap {
......@@ -40,12 +45,14 @@ class ProcessDatamap {
*
* @param string $status
* @param string $table
* @param int $id
* @param int|string $id
* @param array $fieldArray
* @param DataHandler $dataHandler
* @return void
*/
public function processDatamap_afterDatabaseOperations(string $status, string $table, int $id, array $fieldArray, DataHandler $dataHandler): void {
public function processDatamap_afterDatabaseOperations(
string $status, string $table, $id, array $fieldArray, DataHandler $dataHandler
): void {
if (
$table === 'tx_sgmail_domain_model_layout' && isset($fieldArray['default']) &&
in_array($status, ['update', 'new'], TRUE)
......@@ -65,7 +72,10 @@ class ProcessDatamap {
if ((int) $fieldArray['sys_language_uid'] > 0) {
return;
}
$id = (int) $dataHandler->substNEWwithIDs[$id];
if (!MathUtility::canBeInterpretedAsInteger($id)) {
$id = (int) $dataHandler->substNEWwithIDs[$id];
}
$pid = (int) $fieldArray['pid'];
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment