[TYPO3-core] RFC: MM_foreign_select

Franz Holzinger franz at fholzinger.com
Wed Mar 8 16:17:12 CET 2006


Hello René,

my annotations for class.t3lib_loaddbgroup.php:

what is $conf['prepend_tname'] good for?


>  * Usded to collect N

--> used

>     function getRelations_procDB($value, $conf, $uid)    {
>
>             // DB record lists:
>         if ($this->isReferenceField($conf))    {
>             $allowedTables = $conf['type']=='group' ? $conf['allowed']
> : $conf['foreign_table'].','.$conf['neg_foreign_table'];
>             $prependName = $conf['type']=='group' ?
> $conf['prepend_tname'] : $conf['neg_foreign_table'];

$prependName is never used again.

+        if ($MMconf['prepend_tname'] && $MMconf['MM_foreign_select']) {
+            $this->MMmatchTablenames = $this->MMlocalTable;
+        }




> +            foreach($tableArr as $foreignTable) {
> +                $whereArr[] =
> 'tablenames='.$GLOBALS['TYPO3_DB']->fullQuoteStr($foreignTable,
> $tableName);
> +            }
> +            $where.= ' AND ( '.implode(' OR ', $whereArr).' ) ';

Why do you not use 'WHERE tablenames IN ('table1', 'table2', ...
'tablen')'  ?


> $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $tableName, $where,
> '', 'sorting');

The Sorting field should be taken from the TCA of the mm table.

> function writeMM($tableName, $uid, $prependTableName=0)    

Please add here the parameter $pid at the end. It is needed to make the
mm table editable in the backend.



> +        if ($this->MMswapLocalForeign) {
> +            $uid_foreign = 'uid_local';
> +            $uid_local = 'uid_foreign';
> +        } else {
> +            $uid_local = 'uid_local';
> +            $uid_foreign = 'uid_foreign';
> +        }

This codes comes twice. Make a mini function out of it.

> +                $insertFields['sorting'] = $c;

Add the line
                if ($pid)    {
                    $insertFields['pid'] = $pid;
                }


Greets,

Franz














More information about the TYPO3-team-core mailing list