[TYPO3-core] RFC: Feature #10985: Conversion from camelcase to underscores, and back

Oliver Hader oliver at typo3.org
Sun May 3 14:14:05 CEST 2009


FYI: Committed to SVN Trunk (rev. 5384)

olly


Oliver Hader schrieb:
> Hi Sebastian,
> 
> Sebastian KurfŸürst schrieb:
>> This is an SVN patch request.
>>
>> Type: Feature
>>
>> BT Reference: http://bugs.typo3.org/view.php?id=10985
>>
>> Branch: trunk
>>
>> Problem:
>> With Extbase, we introduced a new naming convention for extensions.
>> Example: The extension with key "blog_example" will have Tx_BlogExample
>> as prefix for all PHP classes. We need some way to convert between
>> camelcased and underscored versions - that's what this patch provides in
>> t3lib_div.
>> The same functionality is also needed in Extbase to convert from
>> database tables to property names.
>>
>> Solution:
>> Add a few functions to t3lib_div:
>> - underscoredToUpperCamelCase
>> - underscoredToLowerCamelCase
>> - camelCaseToLowerCaseUnderscored
>> - lowercaseFirst (lowercase first character)
>>
> 
> I changed the methods to use t3lib_div::strtolower or
> t3lib_div::strtoupper to only convert characters of the class [A-Z].
> The method lowercaseFirst was changed to lcfirst to have a similar
> naming as in PHP 5.3.
> 
> Besides that, I created test cases for the newly introduced functions of
> this RFC.
> 
> +1 on reading and testing
> 
> Note to everybody:
> This RFC does not contain anything about "Tx_" or whatever namespace
> prefix...
> 
> olly
-- 
Oliver Hader
TYPO3 Release Manager 4.3


More information about the TYPO3-team-core mailing list