Bug #79585
closedExtbase can't build datamap for custom node type
0%
Description
I have the following scenario:
- there is an extbase extension that uses the pages table as a model source. The model itself features a small subset of the available table fields.
- later - and not related to that extension - the pages table received a new TCA field (without coresponding DB field, that is not needed) with a custom node type.
Each of those points works flawless on its own. The problem is the combination. While extbase tries to build the datamap for the pages model, it encounters the custom node type field and fails with
Uncaught TYPO3 Exception #1381512761: Invalid value "CUSTOMNODETYPE" for enumeration "TYPO3\CMS\Core\DataHandling\TableColumnType"
Adding the requested constant to that mentioned file solves the problem, but it can't be the preferred solution to run a patched or rather forked core forever, just due to a custom node type on the pages table and using extbase.
Upon digging in the core I found a prepared code block that limits building datamaps only for properties. The change goes back to Jochen Rau,
commit 855e650998c7ffa0eb977c074dd54dfa3eeb3535 Author: Jochen Rau <j.rau@web.de> Date: Sun May 2 09:37:51 2010 +0000 [~TASK] Extbase (Persistence): Added comment to build process of a DataMap. Removed debug code.
No explanation is given.
Reintroducing this commented out code resolves the problem with the greedy datamap building. My extension is still fully functional.
So my suggestion is: lets bring us back that piece of code.
Updated by Gerrit Code Review almost 8 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51502
Updated by Gerrit Code Review almost 8 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51502
Updated by Anja Leichsenring almost 8 years ago
to reproduce, you can use ext:blog, that will take care of the pages based model.
For the node type, try the following:
1. create a class in any extension (other, not ext:blog, for staying clear):
namespace <vendor>\<ext>\FormEngine; class CustomNodeType extends AbstractFormElement { ... }
and make it a valid class.
2. Register the nodetype in ext_localconf.php:
$GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'][<timestamp>] = array( 'nodeName' => 'CustomNodeType', 'priority' => 40, 'class' => \<vendor>\<ext>\FormEngine\CustomNodeType::class, );
3. Use the nodetype in pages TCA (ext/Configuration/TCA/Overrides/pages.php:
[columns] => ..., 'customnodetype' => [ 'label' => 'Custom Node Type', 'config' => [ 'type' => 'CustomNodeType' ] ] ... ]; \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes( 'pages', 'customnodetype', '', 'after:description' );
No need for a DB field, the error occures with that settings. Once everything is in place, clear caches and access Frontend. You will encounter the mentioned Error.
Updated by Anja Leichsenring almost 8 years ago
- Status changed from Under Review to Rejected
First things first: this is a usage failure.
1. never define a TCA field for a field that is not available in DB, too. The DataHandler can't handle that situation.
2. don't set the config->type to something custom. This set of valid types is fixed and currently there is no reliable way to extend that set.
3. if you need a custom handler, use renderType. Stick for type with text or any other of the existing ones.