Attention
TYPO3 v11 has reached end-of-life as of October 31th 2024 and is no longer being maintained. Use the version switcher on the top left of this page to select documentation for a supported version of TYPO3.
Need more time before upgrading? You can purchase Extended Long Term Support (ELTS) for TYPO3 v10 here: TYPO3 ELTS.
foreign_unique
foreign\_unique
-
- Type
- string
- Path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']
- Scope
- Display / Proc.
Field which must be unique for all children of a parent record.
Example
Say you have two tables, products, your parent table, and prices, your child table (products) can have
multiple prices. The prices table has a field called customer_group, which is a selector box. Now you want to be
able to specify prices for each customer group when you edit a product, but of course you don't want to specify
contradicting prices for one product (i.e. two different prices for the same customer_group). That's why you
would set foreign_
to the field name "customer_group", to prevent that two prices for the
same customer group can be created for one product.