[TYPO3-dev] edit mm tables in backend forms with TCA
Franz Holzinger
franz at fholzinger.com
Wed Mar 29 08:40:53 CEST 2006
*) This is the question about how the parameter $uid in functions should
be handled when you have to consider 'uid_local' and 'uid_foreign'
instead of 'uid'.
A) function getRecord($table,$uid,$fields='*',$where='') {
$uid is changed to an array with the keys which are the fields.
E.g.
$uid = 12 will be a normal integer for the normal tables as before
$uid['uid_local'] = 34 and $uid['uid_foreign'] = 16 for a mm table.
There could even be more than one foreign key.
$uid['uid_foreignn'] = 43
Advantage: no additional parameter is needed for the functions. So the
interface of the functions remains.
Drawback: the $uid can be an integer or an array.
B) function getRecord($table,$uid,$foreignUids,$fields='*',$where='') {
$foreignUids = 16
If more than one foreign uid would be necessary then it had to be
$foreignUids = '16, 28, ... , 43'.
The fields would come from a entry in the TCA of the table.
$TCA...['foreignFields'] = array('uid_foreign',
'uid_foreign2',...,'uid_foreignn');
Advantage: the foreign uids are in a new variable. You do not have to
care about the field names for the array.
Drawback: All functions using $uid have to be changed.
So which method should be used?
*) Next question:
There are functions who use $pid.
Should a mm table as well must have a 'pid' field?
A) Make it a must.
B) Make it possible to have $pid = '' empty in the functions. The uid is
already the key. For mm tables the uid_local and uid_foreign are the
keys. Pid = 0 should mean that a mm table will be visible in the LIST
module of the root page (world symbol) in the page tree.
C) like B. Each mm table will have in TCA a settings for the related
table to 'uid_local'. The mm table shall be visible where the 'pid' of
the corresponding record in the uid_local's table is.
- Franz
More information about the TYPO3-dev
mailing list