[TYPO3-dev] Annoyed by the use of $GLOBALS['TYPO3_DB']

Steffen Kamper info at sk-typo3.de
Fri Sep 19 19:51:55 CEST 2008


ries van Twisk schrieb:
> 
> On Sep 19, 2008, at 12:17 PM, Steffen Kamper wrote:
> 
>> Benjamin Mack schrieb:
>>> Hey all,
>>>
>>> when I'm developing extensions, I find it very annoying to use
>>> $GLOBALS['TYPO3_DB'] all the time, and it makes the code not so readable
>>> anymore.
>>>
>>> What do you think of having a reference to the $GLOBALS['TYPO3_DB'] in
>>> every instance of pi_base? Similar to what we have with div/lib...
>>>
>>> $this->DB->exec_selectQuery
>>>
>>> what do you think?
>>>
>>>
>>
>> Hey Benni,
>>
>> +1. It doesn't break anything as it can also be accessed with GLOBALS,
>> and DB is used so often ...
>>
> 
> Would it be better to make a static function that return a DB object 
> rather then creating a variable for it??
> 
> something like $db = t3lib_db->getDB();
> Then you can use $db in your extension...
> 
> 
>             regards, Ries van Twisk
> 
Hi Ries,

this is possible anyway like
$db =& $GLOBALS['TYPO3_DB'];

vg Steffen




More information about the TYPO3-dev mailing list