3

everybody!

In a new TYPO3 8.7.10 site, i just created a new extension by using Extension Builder. In that extension, there is a model object ("FurnitureFamily") with a file type property (I called it "symbol"). My extension also has a plugin which displays a list of all furniture families. I created a furniture family and a new page with my plugin.

A new model object in Extension Builder

A new model object in Extension Builder

/**
 * name
 *
 * @var string
 * @validate NotEmpty
 */
protected $name = '';

/**
 * symbol
 *
 * @var \TYPO3\CMS\Extbase\Domain\Model\FileReference
 * @cascade remove
 */
protected $symbol = null;

The problem is that, instead of showing a list with my only record, I get the following error:

Oops, an error occurred! Code: 20180219055419589a6076

With the help of the fh_debug extension, I can get more information about the error:

Oops, an error occurred! Code: 20180219055419589a6076 Unknown column 'sys_file_reference.uid_local:type' in 'where clause' exception code:1472074485 file:/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php line:393 fh_debug trace: file: /typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php" line:226 function:getObjectDataByQuery file: /typo3/sysext/extbase/Classes/Persistence/Generic/PersistenceManager.php" line:126 function:getObjectDataByQuery file: /typo3/sysext/extbase/Classes/Persistence/Generic/QueryResult.php" line:113 function:getObjectDataByQuery file: /typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php" line:567 function:getFirst file: /typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php" line:503 function:mapResultToPropertyValue file: /typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php" line:290 function:mapObjectToClassProperty file: /typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php" line:186 function:thawProperties file: /typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php" line:144 function:mapSingleRow

Curiously, when I remove the property "symbol", The list is shown (only with the property "name").

Being a new installation, I tried compare my database with the specificacion, but there were no changes to make.

My question is: How can I correct that error?

Thank you.

Nawrez
  • 3,314
  • 8
  • 28
  • 42
  • Normally it should write the name with a capital letter in the comment section like * Name, *Symbol.... and you don´t need @cascade remove in my opinion. Could you try to change these two things and tell what´s the output? – Marcel Wasilewski Feb 20 '18 at 15:02

1 Answers1

0

The question is quite old but I still had this issue in TYPO3 version 9 and discovered it it's related to extension-builder which is creating some entries for the field uid_local:type.
The error-message is just blocking everything because for the field is no type defined.

In this screenshot you can see that a field with that name is defined in the table sys_file_reference: enter image description here

Scrolling a long list with table-fields down something like this can be discovered: enter image description here

There a definition for config.items can be found which has typical definitions for some items that can be selected. Even there is only one item, the structure is typical for some kind of form-element for selection. I can imagine form-elements like a select-dropdown-box, radio-buttons or checkboxes. All these elements have this kind of code-structure as definition.

So what I did do to remove the error-message is to just define a 'type' for the field:

$tmp_ttnews_vp_columns['uid_local:type']['config']['type'] = 'select';

On the other hand, the field won't be shown usually, as the table sys_file_reference never follows the extbase-logic and is working different. So it's quite easy and useful to remove some code in the file
your_extension/Configuration/TCA/Overrides/sys_file_reference.php
There is a block with definitions for new or changed fields in that table and most code above or below that list can be removed.

This is above the column-definitions and can be deleted: enter image description here

And a block like this below the desired code can be deleted too: enter image description here

The documentation about the type field can be found here, in the chapter in the bottom is also about the combined notation explained, just not with uid_local but with file: file:type.

There are many situations respectively details why it couldn't work, here the known cases, I can extend the list based on comments later:

  • The default mapping created by extension-builder looks somehow like this:

config.tx_extbase {
persistence {
 classes {

   WDB\TtnewsVp\Domain\Model\FileReference {
     mapping {
       tableName = sys_file_reference
       recordType = Tx_TtnewsVp_FileReference
     }
   }

 }
}
}

here the line recordType = Tx_TtnewsVp_FileReference is disturbing and provoking the error-message like described in the question.
This kind of TypoScript is usually in the file ext_typoscript_setup.typoscript in the root of the extension-folder, so it's always loaded, even if the static template is not included.

  • Annotations in classes might be wrong, including simple faults like typos. Annotations and type-hinting have to be correct (perhaps a missing one is better than a wrong one, but I never tried with missing annotations or type-hints).
David
  • 5,882
  • 3
  • 33
  • 44
  • 1
    Thanks @David for your solution. In my case, the problem occured due to the recordType like u stated. Removing that fixed the problem for me. – Mbigha Siggi Oct 13 '21 at 12:23