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:
uncamelize:
The camelize/uncamelize methods are intended to convert strings with underscores to camel case ones. Specifically, these methods are used by Phalcon\Model
to 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\Text
class has been removed and replaced with the Phalcon\Support\HelperFactory
. The factory is registered in the DI container with the name helper
.
$helper = new Phalcon\Support\HelperFactory();
$result = $helper->camelize('CocoBongo'); //coco_bongo
One can also instantiate the Phalcon\Support\Helper\Camelize
class directly
$camelize = Phalcon\Support\Helper\Camelize();
$result = $camelize('CocoBongo'); // coco_bongo
The same applies to uncamelize