foreign_unique

foreign\_unique
Path

$GLOBALS['TCA'][$table]['columns'][$field]['config']

type

string

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_unique to the field name "customer_group", to prevent that two prices for the same customer group can be created for one product.