Project

General

Profile

Actions

Bug #83779

closed

Doctrine Exception prevents to enable Extensions

Added by Thomas Walder about 6 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2018-02-05
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

When using TYPO3 8.7.9 on Percona Server for MySQL and having a geometry column on a table NOT registered in TCA leads to
Unknown database type geometry requested, Doctrine\DBAL\Platforms\MySQL57Platform may not support it.

Note: There ist no TCA definition for the table tx_test_geodata. This table is not used by Typo 3 but is important for other functionality in this application.

Uncaught TYPO3 Exception
Unknown database type geometry requested, Doctrine\DBAL\Platforms\MySQL57Platform may not support it. 

Doctrine\DBAL\DBALException thrown in file
/app/typo3_src-8.7.9/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php in line 423.

30 Doctrine\DBAL\Platforms\AbstractPlatform::getDoctrineTypeMapping("geometry")

/app/typo3_src-8.7.9/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php:
00124:         $precision = null;
00125: 
00126:         $type = $this->_platform->getDoctrineTypeMapping($dbType);
00127: 
00128:         // In cases where not connected to a database DESCRIBE $table does not return 'Comment'

29 Doctrine\DBAL\Schema\MySqlSchemaManager::_getPortableTableColumnDefinition(array)

/app/typo3_src-8.7.9/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php:
00818: 
00819:             if ( ! $defaultPrevented) {
00820:                 $column = $this->_getPortableTableColumnDefinition($tableColumn);
00821:             }
00822: 

28 Doctrine\DBAL\Schema\AbstractSchemaManager::_getPortableTableColumnList("tx_test_geodata", "typo3", array)

/app/typo3_src-8.7.9/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php:
00173:         $tableColumns = $this->_conn->fetchAll($sql);
00174: 
00175:         return $this->_getPortableTableColumnList($table, $database, $tableColumns);
00176:     }
00177: 

27 Doctrine\DBAL\Schema\AbstractSchemaManager::listTableColumns("tx_test_geodata")

/app/typo3_src-8.7.9/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php:
00279:     public function listTableDetails($tableName)
00280:     {
00281:         $columns = $this->listTableColumns($tableName);
00282:         $foreignKeys = array();
00283:         if ($this->_platform->supportsForeignKeyConstraints()) {

26 Doctrine\DBAL\Schema\AbstractSchemaManager::listTableDetails("tx_test_geodata")

/app/typo3_src-8.7.9/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php:
00266:         $tables = array();
00267:         foreach ($tableNames as $tableName) {
00268:             $tables[] = $this->listTableDetails($tableName);
00269:         }
00270: 

25 Doctrine\DBAL\Schema\AbstractSchemaManager::listTables()

/app/typo3_src-8.7.9/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php:
01038:         }
01039: 
01040:         $tables = $this->listTables();
01041: 
01042:         return new Schema($tables, $sequences, $this->createSchemaConfig(), $namespaces);

24 Doctrine\DBAL\Schema\AbstractSchemaManager::createSchema()

/app/typo3_src-8.7.9/typo3/sysext/core/Classes/Database/Schema/ConnectionMigrator.php:
00251:     {
00252:         // Build the schema definitions
00253:         $fromSchema = $this->connection->getSchemaManager()->createSchema();
00254:         $toSchema = $this->buildExpectedSchemaDefinitions($this->connectionName);
00255: 

23 TYPO3\CMS\Core\Database\Schema\ConnectionMigrator::buildSchemaDiff(boolean)

/app/typo3_src-8.7.9/typo3/sysext/core/Classes/Database/Schema/ConnectionMigrator.php:
00177:     {
00178:         $result = [];
00179:         $schemaDiff = $this->buildSchemaDiff(false);
00180: 
00181:         $schemaDiff->removedTables = [];

22 TYPO3\CMS\Core\Database\Schema\ConnectionMigrator::install(boolean)

/app/typo3_src-8.7.9/typo3/sysext/core/Classes/Database/Schema/SchemaMigrator.php:
00182:             );
00183: 
00184:             $lastResult = $connectionMigrator->install($createOnly);
00185:             $result = array_merge($result, $lastResult);
00186:         }

21 TYPO3\CMS\Core\Database\Schema\SchemaMigrator::install(array)

/app/typo3_src-8.7.9/typo3/sysext/extensionmanager/Classes/Utility/InstallUtility.php:
00481:         if (count($statements) !== 0) {
00482:             $schemaMigrationService = GeneralUtility::makeInstance(SchemaMigrator::class);
00483:             $schemaMigrationService->install($statements);
00484:         }
00485:     }

20 TYPO3\CMS\Extensionmanager\Utility\InstallUtility::updateDbWithExtTablesSql("CREATE TABLE sys_category (↵  l10n_state text↵);↵C…ifier),↵    KEY cache_tag (tag)↵) ENGINE=InnoDB;↵↵↵↵↵")

/app/typo3_src-8.7.9/typo3/sysext/extensionmanager/Classes/Utility/InstallUtility.php:
00407:         $sqlString = $this->emitTablesDefinitionIsBeingBuiltSignal($extensionKey);
00408:         if (!empty($sqlString)) {
00409:             $this->updateDbWithExtTablesSql(implode(LF . LF . LF . LF, $sqlString));
00410:         }
00411:     }

19 TYPO3\CMS\Extensionmanager\Utility\InstallUtility::processRuntimeDatabaseUpdates("mg_dev_be")

/app/typo3_src-8.7.9/typo3/sysext/extensionmanager/Classes/Utility/InstallUtility.php:
00202:         $this->importInitialFiles($extension['siteRelPath'], $extensionKey);
00203:         $this->processDatabaseUpdates($extension);
00204:         $this->processRuntimeDatabaseUpdates($extensionKey);
00205:         $this->saveDefaultConfiguration($extensionKey);
00206:     }

18 TYPO3\CMS\Extensionmanager\Utility\InstallUtility::processExtensionSetup("mg_dev_be")

/app/typo3_src-8.7.9/typo3/sysext/extensionmanager/Classes/Utility/InstallUtility.php:
00188:         }
00189:         $this->reloadCaches();
00190:         $this->processExtensionSetup($extensionKey);
00191: 
00192:         $this->emitAfterExtensionInstallSignal($extensionKey);

17 TYPO3\CMS\Extensionmanager\Utility\InstallUtility::install("mg_dev_be")

/app/typo3_src-8.7.9/typo3/sysext/extensionmanager/Classes/Service/ExtensionManagementService.php:
00360:         $resolvedDependencies = [];
00361:         foreach ($installQueue as $extensionKey => $_) {
00362:             $this->installUtility->install($extensionKey);
00363:             $this->emitHasInstalledExtensionSignal($extensionKey);
00364:             if (!is_array($resolvedDependencies['installed'])) {

16 TYPO3\CMS\Extensionmanager\Service\ExtensionManagementService::installDependencies(array)

/app/typo3_src-8.7.9/typo3/sysext/extensionmanager/Classes/Service/ExtensionManagementService.php:
00223:         $this->downloadQueue->addExtensionToInstallQueue($extension);
00224:         $installQueue += $this->downloadQueue->resetExtensionInstallStorage();
00225:         $installedDependencies = $this->installDependencies($installQueue);
00226: 
00227:         return array_merge($downloadedDependencies, $updatedDependencies, $installedDependencies);

15 TYPO3\CMS\Extensionmanager\Service\ExtensionManagementService::installExtension(TYPO3\CMS\Extensionmanager\Domain\Model\Extension)

/app/typo3_src-8.7.9/typo3/sysext/extensionmanager/Classes/Controller/ActionController.php:
00093:                     $this->installUtility->enrichExtensionWithDetails($extensionKey, false)
00094:                 );
00095:                 if ($this->managementService->installExtension($extension) === false) {
00096:                     $this->redirect('unresolvedDependencies', 'List', null, ['extensionKey' => $extensionKey]);
00097:                 }

14 TYPO3\CMS\Extensionmanager\Controller\ActionController::toggleExtensionInstallationStateAction("mg_dev_be")
13 call_user_func_array(array, array)

/app/typo3_src-8.7.9/typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php:
00314:         if (!$validationResult->hasErrors()) {
00315:             $this->emitBeforeCallActionMethodSignal($preparedArguments);
00316:             $actionResult = call_user_func_array([$this, $this->actionMethodName], $preparedArguments);
00317:         } else {
00318:             $methodTagsValues = $this->reflectionService->getMethodTagsValues(get_class($this), $this->actionMethodName);

12 TYPO3\CMS\Extbase\Mvc\Controller\ActionController::callActionMethod()

/app/typo3_src-8.7.9/typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php:
00174:             $this->initializeView($this->view);
00175:         }
00176:         $this->callActionMethod();
00177:         $this->renderAssetsForRequest($request);
00178:     }

11 TYPO3\CMS\Extbase\Mvc\Controller\ActionController::processRequest(TYPO3\CMS\Extbase\Mvc\Web\Request, TYPO3\CMS\Extbase\Mvc\Web\Response)

/app/typo3_src-8.7.9/typo3/sysext/extbase/Classes/Mvc/Dispatcher.php:
00083:             $controller = $this->resolveController($request);
00084:             try {
00085:                 $controller->processRequest($request, $response);
00086:             } catch (\TYPO3\CMS\Extbase\Mvc\Exception\StopActionException $ignoredException) {
00087:             }

10 TYPO3\CMS\Extbase\Mvc\Dispatcher::dispatch(TYPO3\CMS\Extbase\Mvc\Web\Request, TYPO3\CMS\Extbase\Mvc\Web\Response)

/app/typo3_src-8.7.9/typo3/sysext/extbase/Classes/Mvc/Web/BackendRequestHandler.php:
00030:         /** @var $response \TYPO3\CMS\Extbase\Mvc\ResponseInterface */
00031:         $response = $this->objectManager->get(\TYPO3\CMS\Extbase\Mvc\Web\Response::class);
00032:         $this->dispatcher->dispatch($request, $response);
00033:         return $response;
00034:     }

9 TYPO3\CMS\Extbase\Mvc\Web\BackendRequestHandler::handleRequest()

/app/typo3_src-8.7.9/typo3/sysext/extbase/Classes/Core/Bootstrap.php:
00197:         $requestHandler = $requestHandlerResolver->resolveRequestHandler();
00198: 
00199:         $response = $requestHandler->handleRequest();
00200:         // If response is NULL after handling the request we need to stop
00201:         // This happens for instance, when a USER object was converted to a USER_INT

8 TYPO3\CMS\Extbase\Core\Bootstrap::handleRequest()

/app/typo3_src-8.7.9/typo3/sysext/extbase/Classes/Core/Bootstrap.php:
00184:     {
00185:         $this->initialize($configuration);
00186:         return $this->handleRequest();
00187:     }
00188: 

7 TYPO3\CMS\Extbase\Core\Bootstrap::run("", array)

/app/typo3_src-8.7.9/typo3/sysext/backend/Classes/Http/BackendModuleRequestHandler.php:
00180:             // Run Extbase
00181:             $bootstrap = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Core\Bootstrap::class);
00182:             $content = $bootstrap->run('', $configuration);
00183: 
00184:             $response->getBody()->write($content);

6 TYPO3\CMS\Backend\Http\BackendModuleRequestHandler::dispatchModule("tools_ExtensionmanagerExtensionmanager")

/app/typo3_src-8.7.9/typo3/sysext/backend/Classes/Http/BackendModuleRequestHandler.php:
00087: 
00088:         $moduleName = (string)$this->request->getQueryParams()['M'];
00089:         return $this->dispatchModule($moduleName);
00090:     }
00091: 

5 TYPO3\CMS\Backend\Http\BackendModuleRequestHandler::handleRequest(TYPO3\CMS\Core\Http\ServerRequest)

/app/typo3_src-8.7.9/typo3/sysext/core/Classes/Core/Bootstrap.php:
00313: 
00314:         // Execute the command which returns a Response object or NULL
00315:         $this->response = $requestHandler->handleRequest($request);
00316:         return $this;
00317:     }

4 TYPO3\CMS\Core\Core\Bootstrap::handleRequest(TYPO3\CMS\Core\Http\ServerRequest)

/app/typo3_src-8.7.9/typo3/sysext/backend/Classes/Http/Application.php:
00090:         }
00091: 
00092:         $this->bootstrap->handleRequest($this->request);
00093: 
00094:         if ($execute !== null) {

3 TYPO3\CMS\Backend\Http\Application::run()

/app/typo3_src-8.7.9/typo3/sysext/backend/Resources/Private/Php/backend.php:
00022:     $classLoader = require __DIR__ . '/../../../../../../vendor/autoload.php';
00023: 
00024:     (new \TYPO3\CMS\Backend\Http\Application($classLoader))->run();
00025: });

2 {closure}()

/app/typo3_src-8.7.9/typo3/sysext/backend/Resources/Private/Php/backend.php:
00023: 
00024:     (new \TYPO3\CMS\Backend\Http\Application($classLoader))->run();
00025: });

1 require("/app/typo3_src-8.7.9/typo3/sysext/backend/Resources/Private/Php/backend.php")

/app/typo3_src-8.7.9/typo3/index.php:
00001: <?php
00002: 
00003: require __DIR__ . '/sysext/backend/Resources/Private/Php/backend.php';

Maybe related to #81264


Related issues 2 (0 open2 closed)

Has duplicate TYPO3 Core - Bug #84233: Type BIT not supported by Typo3/Doctrine DBAL (working with alternative DB)Closed2018-03-13

Actions
Has duplicate TYPO3 Core - Bug #87008: Doctrine/DBAL exception in Extension Manager when extension is installed - PostgreSQL/PostGIS databaseClosed2018-11-26

Actions
Actions #1

Updated by Tymoteusz Motylewski about 6 years ago

can you also share the ext_tables.sql file contents?

Actions #2

Updated by Stephan Großberndt about 6 years ago

When using TYPO3 8.7 with PostgreSQL I solved the according problem in my extension by adding composer requirements to

  "require": {
    "jsor/doctrine-postgis": "^1.4",
    "hisamu/php-xbase": "^1.0" 
  }

Of course it would be great if this could be part of the core for all systems, but not all database systems have geometry support. We should think about adding it at least for MySQL, PostgreSQL and Oracle (if available).

Actions #3

Updated by Georg Ringer about 6 years ago

can you give me a hint how this composer packages fix those issues? I stumble upon the same stuff https://stackoverflow.com/questions/48399723/typo3-unknown-database-type-timestamp-requested-sqlserver2012 and have no idea how to fix this

the problem is that I have multiple connections which I use within extensions for e.g. imports and those should be left alone by the SchemaMigrator. Currently \TYPO3\CMS\Core\Database\Schema\SchemaMigrator::getSchemaDiffs runs over all available connections and creates schema diffs which will of course fail with the exceptions above as TYPO3 can't handle that.

Actions #4

Updated by Stephan Großberndt about 6 years ago

The composer packages I mentioned fix this issue only for PostgreSQL as they add support for geometry columns for PostGIS in PostrgreSQL only. Maybe there exist similar solutions extending Doctrine to support geometries on MySQL/Oracle. I just wanted to give a hint on what type of package you should be looking for.

Actions #5

Updated by Thomas Walder about 6 years ago

Tymoteusz Motylewski wrote:

can you also share the ext_tables.sql file contents?

Heres the table definition in ext_tables.sql

CREATE TABLE `tx_test_geodata` (
  `uid` int(11) unsigned NOT NULL auto_increment,
  `parent_id` int(11) unsigned NOT NULL,
  `geom` geometry NOT NULL,
  PRIMARY KEY (`uid`),
  UNIQUE KEY `parent_id` (`parent_id`),
  SPATIAL KEY `i_geomidx` (`geom`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Actions #6

Updated by Stephan Großberndt about 6 years ago

With the mentioned composer package I can use the table in TCA as well. If you do not need it there - are you sure you need the ext_tables.sql? Until this is solved you can remove that at the cost of having to maintain the schema updates yourself.

Actions #7

Updated by Thomas Walder about 6 years ago

Hi,
Stephan Großberndt wrote:

With the mentioned composer package I can use the table in TCA as well. If you do not need it there - are you sure you need the ext_tables.sql? Until this is solved you can remove that at the cost of having to maintain the schema updates yourself.

same error if I remove the table definition from ext_tables.sql

Actions #8

Updated by Georg Ringer about 6 years ago

  • Has duplicate Bug #84233: Type BIT not supported by Typo3/Doctrine DBAL (working with alternative DB) added
Actions #9

Updated by Riccardo De Contardi almost 6 years ago

  • Category set to Database API (Doctrine DBAL)
Actions #10

Updated by Georg Ringer about 4 years ago

  • Has duplicate Bug #87008: Doctrine/DBAL exception in Extension Manager when extension is installed - PostgreSQL/PostGIS database added
Actions #11

Updated by Susanne Moog about 4 years ago

  • Status changed from New to Needs Feedback

Can you please check if registering your type via `$connection->getDatabasePlatform()->registerDoctrineTypeMapping(...);` and `\Doctrine\Dbal\Types\Type::addType(...)` helps? You should be able to do that via a middleware for the backend at an early point.

The core supports the basic doctrine type set out of the box and types "SET" and "ENUM" in addition (take a look at the EnumType for an implementation example).

If you are using further types you should provide the configuration yourself - which should work via the methods mentioned above.

Actions #12

Updated by Riccardo De Contardi over 2 years ago

  • Status changed from Needs Feedback to Closed

A lot of time passed with no feedback; I think it's safe to close this issue for now.

If you think that this is the wrong decision, please reopen it or ping me and I'll do it. Otherwise, open a new fresh issue with a reference to this one.

Thank you.

Actions

Also available in: Atom PDF