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

PHP Warning: Undefined property: DirectMailTeam\DirectMail\DmQueryGenerator::$settings in Classes/DmQueryGenerator.php line 109 #529

Open
format-gmbh opened this issue Oct 29, 2024 · 2 comments

Comments

@format-gmbh
Copy link

When I call up the ‘Recipient list’ module, I receive the following error message:
Core: Exception handler (WEB): Uncaught TYPO3 Exception: #1476107295: PHP Warning: Undefined property: DirectMailTeam\DirectMail\DmQueryGenerator::$settings in /var/www/html/vendor/directmailteam/direct-mail/Classes/DmQueryGenerator.php line 109

If I fix this error provisionally, I receive the following error message:
TYPO3\CMS\Lowlevel\Controller\DatabaseIntegrityController::makeSelectorTable(): Argument #2 ($request) must be of type Psr\Http\Message\ServerRequestInterface, string given, called in /var/www/html/vendor/directmailteam/direct-mail/Classes/DmQueryGenerator.php on line 113

TYPO3 12.4.22
PHP 8.3
Branch "12.x-dev"
composer mode

@Patta
Copy link
Contributor

Patta commented Nov 5, 2024

I can confirm this issue.

Environment:
TYPO3 12.4.22
PHP 8.2
direct_mail 12.x 500a858
composer mode

warning-log:

Tue, 05 Nov 2024 10:19:15 +0100 [WARNING] request="16b32fb740372" component="TYPO3.CMS.Core.Error.ErrorHandler": Core: Error handler (BE): PHP Warning: Undefined property: DirectMailTeam\DirectMail\DmQueryGenerator::$settings in /var/www/vhosts/REMOVED/typo3_12.4_prod/vendor/directmailteam/direct-mail/Classes/DmQueryGenerator.php line 109 
Tue, 05 Nov 2024 10:19:15 +0100 [CRITICAL] request="16b32fb740372" component="TYPO3.CMS.Core.Error.ProductionExceptionHandler": Core: Exception handler (WEB: BE): TypeError, code #0, file /var/www/vhosts/REMOVED/typo3_12.4_prod/vendor/typo3/cms-lowlevel/Classes/Controller/DatabaseIntegrityController.php, line 2242: TYPO3\CMS\Lowlevel\Controller\DatabaseIntegrityController::init(): Argument #4 ($settings) must be of type array, null given, called in /var/www/vhosts/REMOVED/typo3_12.4_prod/vendor/directmailteam/direct-mail/Classes/DmQueryGenerator.php on line 109 - {"mode":"WEB","application_mode":"BE","exception_class":"TypeError","exception_code":0,"file":"/var/www/vhosts/REMOVED/typo3_12.4_prod/vendor/typo3/cms-lowlevel/Classes/Controller/DatabaseIntegrityController.php","line":2242,"message":"TYPO3\\CMS\\Lowlevel\\Controller\\DatabaseIntegrityController::init(): Argument #4 ($settings) must be of type array, null given, called in /var/www/vhosts/REMOVED/typo3_12.4_prod/vendor/directmailteam/direct-mail/Classes/DmQueryGenerator.php on line 109","request_url":"https://REMOVED/typo3/module/directmail/recipientlist?token=--AnonymizedToken--&id=7439","exception":null}

@christophlehmann
Copy link
Contributor

When i remember correctly, this error occurs only when your recipient lists are build from special queries. This is a nice feature, but due xclassing, etc. it tends to break again and again. As an alternative, custom recipient lists are very easy to implement with the cool new events:

    public function __invoke(RecipientListCompileMailGroupEvent $event): void
    {
        $group = $event->getMailGroup();
        $idLists = $event->getIdLists();
        if ($group['type'] === self::MAILGROUP_TYPE) {
            $recipientUids = $this->guildRecipientsRepository->getRecipientUids($group['guild']);
            $idLists[GuildRecipientsRepository::TABLE] = array_merge($idLists[GuildRecipientsRepository::TABLE] ?? [], $recipientUids);
            $event->setIdLists($idLists);
        }
    }

    public function compileMailGroup(DmailCompileMailGroupEvent $event): void
    {
        $groupIds = $event->getMailGroup();
        foreach ($groupIds as $groupId) {
            $group = BackendUtility::getRecord(
                'sys_dmail_group',
                $groupId,
                '*',
                'AND type=' . self::MAILGROUP_TYPE
            );
            if ($group) {
                $recipientUids = $this->guildRecipientsRepository->getRecipientUids($group['guild']);
                $idLists[GuildRecipientsRepository::TABLE] = array_merge(
                    $idLists[GuildRecipientsRepository::TABLE] ?? [],
                    $recipientUids
                );
                $event->setIdLists($idLists);
            }
        }
    }

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

3 participants