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

Multiple Edit Content Elements Error: In2code\Powermail\Utility\DatabaseUtility::getPidForRecord(): Argument #1 ($uid) must be of type int, string given, called in /var/www/vendor/in2code/powermail/Classes/EventListener/FlexFormParsingModifyEventListener.php on line 89 #953

Closed
huersch opened this issue Jan 17, 2024 · 1 comment
Assignees
Labels

Comments

@huersch
Copy link

huersch commented Jan 17, 2024

When using the list view to edit multiple content elements simultaneously, for example, by modifying the header on a page where a Powermail plugin exists, Powermail fails. This is because getPidForCurrentRecord assumes that it always receives only one UID in the request.

A possible solution could be to add a simple string check or implement a more elegant approach:

private function getPidForCurrentRecord(): int
    {
        $request = $this->getRequest();
        $queryParams = $request->getQueryParams();
        $uid = array_keys($queryParams['edit']['tt_content'] ?? [])[0] ?? 0;
        if (is_string($uid)) {
            $uid = intval(explode(",",$uid)[0]);
        }

        return DatabaseUtility::getPidForRecord($uid, 'tt_content');
    }
@mschwemer mschwemer self-assigned this Aug 9, 2024
@mschwemer mschwemer added the bug label Aug 9, 2024
mschwemer added a commit that referenced this issue Oct 9, 2024
@mschwemer
Copy link
Collaborator

Fixed in 3235d33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants