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

ries van Twisk typo3 at rvt.dds.nl
Fri Sep 19 19:45:19 CEST 2008


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


-------------------------------------------------------------------------------------------------
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?





More information about the TYPO3-dev mailing list