問題タブ [typo3-tca]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
typo3 - TYPO3 - TCA, IRRE and Database configuration for value objects
On the extbase side, a class can extend TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
. But I can't figure out how to implement a value object inside TCA-Konfiguration and ext_tables.sql
. Bonus points for IRRE implementation.
A value object has no real 'uid' but is defined by all of it's properties. An example could be "rgb-color", which is defined/unique by the combination of it's values r,g and b.
So I imagine that when a user adds a value object of type "rgb-color" with values 255 0 0 to a parent record, something like this should happen:
- If there is no entry for a value object with values 255 0 0 stored in the database table
tx_extkey_domain_model_rgbcolor
, one will be created and this will be assigned to the parent record (probably via mm table) - If now another user also adds a color with values 255 0 0 to another parent record, no new entry will be created in
tx_extkey_domain_model_rgbcolor
, but the already existing one will be used
I can't find any useful resources about actually implementing value objects in TYPO3. I have found this article explaining the difference between entities and value objects:
I even searched the TYPO3 source code for classes extending AbstractValueObject
and their corresponding TCA configuration but couldn't find anything.
I'm interested in this because I think maybe this can have a positive impact on performance when querying for many parent objects.
Any help, links to tutorials or better documentation would help. I'm also not quite sure if value objects are really a thing for TYPO3 extensions.
typo3 - TYPO3 TCA は「デフォルト」値を動的にする
タイトルはかなり自明ですが、私が欲しいのは動的なデフォルト値です。
その背後にある考え方は、データベース内の列から最大の数値を取得し、結果に 1 を追加することです。この結果はデフォルト値として保存する必要があります。
たとえば、次のコードを見てみましょう。
SQL は次のようになります。
では、どうすればその「きれい」にできますか?
私は考えましprocessCmdmap_preProcess
たが、対応するTCAフィールドに値を渡す方法がわかりません。さらに、オブジェクトを保存した後にDebuggerUtility
使用した場合と同じように使用しても、バックエンドで結果が得られません。processDatamap_afterAllOperations
誰かが私を正しい方向に向けることができますか?