Reputation: 527
TYPO3 v11
There is an external database configured:
'DB' => [ 'Connections' => [ 'MyDatabase' => [ 'charset' => 'utf8', 'dbname' => 'mydatabase', 'driver' => 'mysqli', 'host' => '127.0.0.1', 'password' => 'xxx', 'port' => 3336, 'user' => 'myuser', ], 'Default' => [ 'charset' => 'utf8', 'dbname' => 'typo3database', 'driver' => 'mysqli', 'host' => '127.0.0.1', 'password' => 'xxx', 'port' => 3306, 'user' => 'typo3user', ], ], 'TableMapping' => [ 'initiatives' => 'MyDatabase', 'municipalities' => 'MyDatabase', ], ]
Extbase table mapping is configured in Configuration/Extbase/Persistence/Classes.php
:
return [
\MyVendor\MyExt\Domain\Model\Initiative::class => [
'tableName' => 'initiatives',
'properties' => [
'uid' => [
'fieldName' => 'id'
]
]
],
\MyVendor\MyExt\Domain\Model\Municipality::class => [
'tableName' => 'municipalities',
'properties' => [
'uid' => [
'fieldName' => 'id'
]
]
]
];
A plugin is configured in ext_localconf.php
:
use MyVendor\MyExt\Controller\InitiativeController;
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'MyExt',
'List',
array(
InitiativeController::class => 'list,show',
),
// non-cacheable actions
array(
InitiativeController::class => 'list,show',
)
);
Everything works fine for the plugin, but: When I try to delete a page I get an error message:
(1/3) Doctrine\DBAL\Exception\InvalidFieldNameException
An exception occurred while executing 'SELECT `uid` FROM `initiatives`
WHERE `pid` = ? ORDER BY `uid` ASC' with params [14535]:
Unknown column 'uid' in 'field list'
The external database doesn't use uid
but id
instead. DBAL cannot map this. That is why this error occurs. But why the external table is queried at all? It is just a simple TYPO3 page which should be deleted!
Is there a misconfiguration somewehre, or is something missing one my side?
Upvotes: 0
Views: 13
Reputation: 527
I gave up the idea of mapping the external database into the TYPO3 system. As the external database does not work with 'uid' the DBAL data mapping is not functioning properly. There seems to be no way as the 'uid' column is absolutely needed. All other columns can be mapped, but this one not.
Upvotes: 0