1

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:

https://docs.typo3.org/typo3cms/ExtbaseFluidBook/latest/2-BasicPrinciples/2-Domain-Driven-Design.html#to-model-the-domain

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.

4

0 に答える 0