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

Oliver Hader oh at inpublica.de
Thu Sep 27 19:21:29 CEST 2007


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.

Just wanted to give you a hint. But since you're Mr. Clever, please
solve it on your own!


Cheers!
olly
-- 
Oliver Hader
http://inpublica.de/




More information about the TYPO3-dev mailing list