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

Oliver Hader oliver at typo3.org
Fri May 1 16:10:04 CEST 2009


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
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0010985_v2.patch
Url: http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20090501/89754e9b/attachment.txt 


More information about the TYPO3-team-core mailing list