Task #104561
closedUse TYPO3 Connection in transactional
100%
Description
Hello,
I just found method Connection::transactional(). You can use it like that:
$connection = GeneralUtility::makeInstance(ConnectionPool::class) ->getConnectionByName(ConnectionPool::DEFAULT_CONNECTION_NAME); $queryResult = $connection->transactional(function (\Doctrine\DBAL\Connection $transactionalConnection) use ($sql): ?Result { try { $transactionalConnection->executeStatement('SET profiling=1;'); $transactionalConnection->executeQuery($sql); return $transactionalConnection->executeQuery('SHOW profile;'); } catch (Exception $e) { } return null; });
As you see you have to use the Doctrine Connection object within the Callable. Else phpstan will fail.
What do you think? Can we implement our own interpretation of transactional into TYPO3 Connection where the Callables argument is of type TYPO3 Connection?
Nice greeting
Stefan
Updated by Benni Mack 3 months ago
- Target version changed from 13.3 to Candidate for Major Version
Updated by Gerrit Code Review 4 days ago
- Status changed from New to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/87675
Updated by Stefan Bürk 4 days ago
- Tracker changed from Feature to Task
- PHP Version changed from 8.3 to 8.1
- TYPO3 Version set to 12
Updated by Gerrit Code Review 4 days ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/87675
Updated by Gerrit Code Review 4 days ago
Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/87675
Updated by Gerrit Code Review 3 days ago
Patch set 1 for branch 13.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/87693
Updated by Stefan Bürk 3 days ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset dd1a1d19899d67946d4f183ddb147637e8baf6d2.
Updated by Stefan Bürk 3 days ago
- Related to Task #105913: Use correct test fixture extension version constraints added