Sunday, March 29, 2009

Re: how to map enums with strings

i have set them as $s = array('Google'=>'G','Yahoo'=>'Y','MSN'=>'M');
and its working gud..
thanx everyone..:)

/i belive that i will solve somebody's problem one day..

On Mar 29, 10:38 pm, brian <bally.z...@gmail.com> wrote:
> Why don't you simply set the enum values to Google, Yahoo, etc?
>
> On Sun, Mar 29, 2009 at 12:09 PM, aman batra <batra_aman2...@yahoo.com> wrote:
>
> > actually i wanted something which could map the things and what i have
> > done is that i created an array which is describing what i want
> > like :-
> > $s = array('Google'=>'G','Yahoo'=>'Y','MSN'=>'M');
>
> > On Mar 29, 8:38 pm, "Dr. Loboto" <drLob...@gmail.com> wrote:
> >> From point of SQL queries enum values are strings. So you will retrive
> >> 'G', 'Y' and 'M' as well as should save 'G', 'Y' and 'M'. Anywhere you
> >> want to display 'Google', 'Yahoo' and 'MSN' instead of actual values
> >> you should change then manually. Cake do not provide anything for it.
>
> >> On Mar 29, 5:35 pm, aman batra <batra_aman2...@yahoo.com> wrote:
>
> >> > Hello,
> >> > I have in my Db table a column agent which takes the value as enum
> >> > ('G','Y','M') and where
> >> > G = google
> >> > Y = yahoo
> >> > M = msn
> >> > How should i map the strings google, yahoo, etc which will be the
> >> > output of my function to map as G,Y,etc so that my Db query recognise
> >> > it and saves it to the database.
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: