flux icon indicating copy to clipboard operation
flux copied to clipboard

Delete content element not working if it is hidden

Open stoutik opened this issue 3 years ago • 4 comments

TYPO3 11.5.5 flux: dev-development

When I try to delete a hidden content element, I have the following error:

image

The problem comes from this file:

Classes/Integration/HookSubscribers/DataHandlerSubscriber.php

To solve the problem, you could implement the following adjustments:

 protected function getSingleRecordWithRestrictions(string $table, int $uid, string $fieldsToSelect): ?array
     {
         $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($table);
         $queryBuilder->select(...GeneralUtility::trimExplode(',', $fieldsToSelect))
             ->from($table)
             ->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT)));
         return $queryBuilder->execute()->fetch() ?:  [];
     }
protected function getSingleRecordWithoutRestrictions(string $table, int $uid, string $fieldsToSelect): ?array
    {
        $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($table);
        $queryBuilder->getRestrictions()->removeAll();
        $queryBuilder->select(...GeneralUtility::trimExplode(',', $fieldsToSelect))
            ->from($table)
            ->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT)));
        return $queryBuilder->execute()->fetch() ?: [];
    }

stoutik avatar Apr 11 '22 16:04 stoutik

Hi there Sorry for rehandle this issue. I use TYPO3 V10.4.28 with Flux V9.6.1. If I remove or delete a hidden flux content element I still got following error:

Argument 1 passed to FluidTYPO3\Flux\Provider\AbstractProvider::getGrid() must be of the type array, null given, called in /home/webtecha/www/webtech.ch/typo3104/public/typo3conf/ext/flux/Classes/Integration/HookSubscribers/DataHandlerSubscriber.php on line 433

If I activate that content element and then remove or delete it, it does work. Could you please recheck it and search for a fix? Thanks in advance for your effort.

DanYouCan avatar May 16 '22 09:05 DanYouCan

This bug has been caused by #1896 and is present since flux version 9.6.0.

@peterreichenbach correctly wrote there:

it is not possible anymore to do anything with restricted (hidden, starttime, endtime, fe_group) content elements. restriction in getSingleRecordWithRestrictions should be only "deleted".

cweiske avatar May 18 '22 13:05 cweiske

@cweiske Thank you for taking your time to find a properly solution.

DanYouCan avatar May 23 '22 09:05 DanYouCan

@cweiske Thanks for your patch, it works just fine now.

jacobsenj avatar May 25 '22 06:05 jacobsenj

Up, any news on this topic. We also face the issue on one of our websites.

lucmuller avatar Aug 30 '22 09:08 lucmuller

I'm having the same issue, running Flux 9.6.1 on TYPO3 11.5.16.

RKlingler avatar Oct 11 '22 07:10 RKlingler