[TYPO3-dev] A way to detect if table has a certain field

Tapio Markula tapio.markula at xetpoint.fi
Thu Sep 27 19:30:51 CEST 2007


Oliver Hader kirjoitti:
> Hi Tapio,
> 
> Tapio Markula schrieb:
>> Oliver Hader kirjoitti:
>>> Tapio Markula schrieb:
>>>> Is there any core function to detect if the table has certain field.
>>>> I would need to know if table has fieds 'pid' and 'deleted'
>>> If the field is defined in $TCA you could do:
>>> t3lib_div::loadTCA('myTable');
>>> if (isset($GLOBALS['TCA']['myTable']['columns']['myField'])) {
>>>     // Field 'myField' of table 'myTable' was defined in $TCA
>>> }
>> there is *newer* TCA for uid,pid and deleted - they are handled always
>> internally.
> 
> If you would read my message, you wouldn't have taken the step to write
> this. I've written "[...] If the field you're looking for isn't defined
> in $TCA, e.g. 'uid' [...]". I knew that these fields are not defined in
> $TCA.

the TCA information was in this case totally useless but I got other 
hints, which helped me to solve the problem




More information about the TYPO3-dev mailing list