‪TYPO3CMS  ‪main
DoctrineTransportFactory.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use Doctrine\DBAL\DriverManager;
21 use Symfony\Component\Messenger\Bridge\Doctrine\Transport\Connection;
22 use Symfony\Component\Messenger\Bridge\Doctrine\Transport\DoctrineTransport;
23 use Symfony\Component\Messenger\Transport\Serialization\SerializerInterface;
24 
29 {
30  public function ‪__construct(private SerializerInterface $serializer) {}
31 
32  public function ‪createTransport(array $options = []): DoctrineTransport
33  {
34  $options['table_name'] ??= 'sys_messenger_messages';
35  if ($options['table_name'] === 'sys_messenger_messages') {
36  $options['auto_setup'] = false;
37  }
38 
39  // use native doctrine dbal connection instead of TYPO3s overwritten one
40  // as the overwritten querybuilder is not fully compatible with symfony messenger
41  $connection = DriverManager::getConnection(‪$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']);
42  $doctrineTransportConnection = new Connection($options, $connection);
43  return new DoctrineTransport($doctrineTransportConnection, $this->serializer);
44  }
45 }
‪TYPO3\CMS\Core\Messenger\DoctrineTransportFactory\createTransport
‪createTransport(array $options=[])
Definition: DoctrineTransportFactory.php:32
‪TYPO3\CMS\Core\Messenger\DoctrineTransportFactory\__construct
‪__construct(private SerializerInterface $serializer)
Definition: DoctrineTransportFactory.php:30
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Core\Messenger\DoctrineTransportFactory
Definition: DoctrineTransportFactory.php:29
‪TYPO3\CMS\Core\Messenger
Definition: BusFactory.php:18