Skip to content

Commit

Permalink
[TASK] Remove outdated TCA type user dbType json (#900)
Browse files Browse the repository at this point in the history
This was removed in favor of a dedicated TCA type `json`.

Releases: main, 12.4
  • Loading branch information
nhovratov authored Jan 10, 2024
1 parent 876bbb1 commit ddb9db9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 83 deletions.
64 changes: 0 additions & 64 deletions Documentation/ColumnsConfig/Type/User/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,70 +126,6 @@ This example is also described in TYPO3 Explained,
Properties
==========

.. _columns-user-properties-dbType:

dbType
------

.. versionadded:: 12.2
The dbType `json` was introduced to allow storage and usage of JSON data.

.. confval:: dbType (type => user)

:Path: $GLOBALS['TCA'][$table]['columns'][$field]['config']['dbType']
:type: string
:Scope: Proc

`json`
When the property dbType is set to `json`, the form engine
provides the decoded JSON to the RecordProviders and the `user`
PHP implementation (extending :php:`TYPO3\CMS\Backend\Form\Element\AbstractFormElement`)
can then use the field value.

.. note:: In the frontend and in custom backend implementations the
implementing code still **must** decode the string into a PHP array:

If :ref:`Connection->insert() <t3coreapi:database-connection-insert>`
or :ref:`Connection->update() <t3coreapi:database-connection-update>` are
used, and not specified types handed over, the database scheme is
used and the native format for JSON fields data will then encoded.

This does not work for :ref:`QueryBuilder <t3coreapi:database-query-builder>`.
Same goes for Extbase, which is not decoding this field type yet
but retrieving it as a string.

dbType = json example
~~~~~~~~~~~~~~~~~~~~~

The system extension :t3ext:`reactions` uses a TCA field of type `user` with
the dbType `json`:

.. code-block:: php
:caption: :t3src:`reactions/Configuration/TCA/Overrides/sys_reaction_create_record.php` (excerpt)
<?php
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns(
'sys_reaction',
[
// ...
'fields' => [
'label' => 'LLL:EXT:reactions/Resources/Private/Language/locallang_db.xlf:sys_reaction.fields',
'config' => [
'type' => 'user',
'renderType' => 'fieldMap',
'dbType' => 'json',
'default' => '{}',
],
],
]
);
The implementing class receives the parsed JSON as PHP array:

.. literalinclude:: _includes/_FieldMapElement.php
:caption: :t3src:`reactions/Classes/Form/Element/FieldMapElement.php` (excerpt)

.. _columns-user-properties-renderType:

renderType
Expand Down

This file was deleted.

0 comments on commit ddb9db9

Please sign in to comment.