typo3extbaseflexform

Setting relation values in a nested TYPO3 Extbase Backendform


Suppose I have this database model in extbase:

model A - property - n:1 relation to model B

model B - property - n:1 relation to model C

model C - property

Can I achieve something like this in the backend form of model A?

instance of model B 1 [] good [] bad

instance of model B 2 [] good [] bad

and so on.

Short, I want to set the values for the property of model C in the form of model A for all instances of model B. Is there a way to do this in the TCA configuration or with a nested flexform?


Solution

  • Yes, that is possible. Although I think you want to do that in Model C (or I misunderstood you or 1,n are mixed up). I assume C 1<=>n B 1<=>n A.

    Have a look at the inline column type https://docs.typo3.org/m/typo3/reference-tca/master/en-us/ColumnsConfig/Type/Inline.html, also referred to as "IRRE" (inline relational something). This allows to create and edit sub-records inline. Check out the column types group and select, too. They are suitable for 1..n:n relations, too.

    This works in TCA and Flexform (for Model C). Persistence IIRC in IRRE must be done to the DB (as opposed to a flexform string like e.g. tt_content.pi_flexform), so Model B and A should be TCA-defined and have tables.