[TYPO3-english] $TCA ignore pid and load all records into select box

Muriel le Pair typo3 at strangefruit.nl
Thu Jun 27 14:15:14 CEST 2013


Op 26-06-13 19:46, Jigal van Hemert schreef:
> Hi,
>
> On 26-6-2013 16:48, Muriel le Pair wrote:
>> In the BE I want to load all records of an other table into a select
>> box, since these records are part of the extension it should ignore the
>> pid.
>>
>> I tried setting rootLevel to 1, but somehow that doesn't make any
>> difference:
>>
>> 'language' => array(
>>      'exclude' => 0,
>>      'config' => array(
>>          'type' => 'select',
>>          'foreign_table' =>
>> 'tx_sfcodehighlighter_domain_model_languageall',
>>          'rootLevel' => 1,
>>          'minitems' => 0,
>>          'maxitems' => 1,
>>      ),
>> ),
>>
>> "If set, the "foreign_table_where" will be ignored and a "pid=0" will be
>> added to the query to select only records from root level of the page
>> tree."
>> http://docs.typo3.org/typo3cms/TCAReference/Reference/Columns/Select/Index.html
>>
>
> This setting ignores whatever is set in 'foreign_table_where' (which you
> don't use, so no change here) and adds 'pid=0'. The last part will only
> show records that are in the root of the site (the page with the TYPO3
> logo), but no other pages/folders.
>
> Without that setting you should see all records in the entire
> installation, except those from pages where the user that edits the
> record doesn't have access to.

Hi Jigal,

The odd thing is that rootLevel = 1 seems to be ignored all together.
Is this a bug, or am I doing something wrong?

When I set rootLevel to 1 it outputs the following query:
SELECT tx_sfcodehighlighter_domain_model_languageall1.uid FROM 
tx_sfcodehighlighter_domain_model_languageall1, pages WHERE 
pages.uid=tx_sfcodehighlighter_domain_model_languageall1.pid
AND pages.deleted=0 AND 1=1

When I add:
'foreign_table_where' => 'AND 
tx_sfcodehighlighter_domain_model_languageall1.pid=0',
It outputs the following query:
SELECT tx_sfcodehighlighter_domain_model_languageall1.uid FROM 
tx_sfcodehighlighter_domain_model_languageall1, pages WHERE 
pages.uid=tx_sfcodehighlighter_domain_model_languageall1.pid
AND pages.deleted=0 AND 1=1 AND 
tx_sfcodehighlighter_domain_model_languageall1.pid=0

In both cases the rootLevel setting is ignored.

I don't want all records that are linked to the current page, but all 
records. So how do I delete 
pages.uid=tx_sfcodehighlighter_domain_model_languageall1.pid from the query?

--
kind regards,

Muriel le Pair





More information about the TYPO3-english mailing list