I am having an issue with camelize/uncamelize (\Phalcon\Text)
My understanding is that this function creates camel case strings like ucwords() or ucfirst()
The following tests reveal: This test passes:
camelize:
- nice -> Nice
- nice weather -> NiceWeather (Not sure if this should be like that. The space is stripped out. If this is the intended behavior then we need to add it to the docs)
- nice_weather -> NiceWeather (Why does the underscore disappear? If this is the intended behavior then we need to add it to the docs)
- nIcE -> Nice
uncamelize:
- Nice -> nice
- Nice Weather -> nice weather
- Nice_Weather -> nice_weather
- NIcE -> nic_e (the capital letter switches to underscore)
The camelize/uncamelize methods are intended to convert strings with underscores to camel case ones. Specifically, these methods are used by
Phalcon\Modelto convert table names to their respective classes and vice versa. Thus, we can get the name of a table from the class name.Reference:
http://docs.phalconphp.com/en/4.0/api/Phalcon_Text.html
For Phalcon v5.0 the
Phalcon\Textclass has been removed and replaced with thePhalcon\Support\HelperFactory. The factory is registered in the DI container with the namehelper.One can also instantiate the
Phalcon\Support\Helper\Camelizeclass directlyThe same applies to
uncamelize