Feature request: make camelfy(), beau() public

48 views
Skip to first unread message

Corey

unread,
Feb 22, 2021, 10:27:37 AM2/22/21
to redbeanphp
On a couple projects I've needed to convert strings to or from camel case for Redbean. For consistency and convenience, it would be great if the methods included with Redbean were public e.g. R::camelfy($string), R::uncamelfy($string).

Thanks!

Corey

Ben Major

unread,
Feb 22, 2021, 11:38:59 AM2/22/21
to redbe...@googlegroups.com
RedBean should automatically handle the transliteration for you, so I don't see why you would need to use these methods in your own code?

--
You received this message because you are subscribed to the Google Groups "redbeanphp" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redbeanorm+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/redbeanorm/a6b1f233-f875-4f43-b794-c5a27105ef2fn%40googlegroups.com.

Corey from Gelform Inc

unread,
Feb 22, 2021, 3:19:21 PM2/22/21
to redbe...@googlegroups.com
I set bean properties using camel case (so they match javascript var names), but when I load and export a bean, property names are snake case. So I convert them before sending them back to the front end. Just like isoDateTime, these methods would ensure naming is consistent and would prevent me having to duplicate the code.

You received this message because you are subscribed to a topic in the Google Groups "redbeanphp" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/redbeanorm/xHjXpV_mBwg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to redbeanorm+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/redbeanorm/CAHrgLKj1ErywGJACvx45GpyZpb_NA-M_sm4XaofVhnx4dst6YA%40mail.gmail.com.

Ben Major

unread,
Feb 22, 2021, 3:54:05 PM2/22/21
to redbe...@googlegroups.com
Why do you need the properties to match JS vars, though? Are you mapping API responses to JS objects or some such? 

Corey from Gelform Inc

unread,
Feb 22, 2021, 3:58:43 PM2/22/21
to redbe...@googlegroups.com
Just convenience. In my world, javascript is generally camel cased and php is snake cased. So when I export a bean for an api request response, all properties are camel cased for the javascript to read.

gabor

unread,
Feb 24, 2021, 7:07:47 AM2/24/21
to redbeanphp
I will create an issue for this on github

Corey from Gelform Inc

unread,
Feb 24, 2021, 7:36:55 AM2/24/21
to redbe...@googlegroups.com
Wonderful! Thank you!

--
You received this message because you are subscribed to a topic in the Google Groups "redbeanphp" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/redbeanorm/xHjXpV_mBwg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to redbeanorm+...@googlegroups.com.

gabor

unread,
Mar 1, 2021, 7:49:39 AM3/1/21
to redbeanphp

Corey from Gelform Inc

unread,
Mar 1, 2021, 7:55:27 AM3/1/21
to redbe...@googlegroups.com
Awesome! I really appreciate you accomodating me.

Corey

Reply all
Reply to author
Forward
0 new messages