I don't think it's an inconsistency. Quoting from
http://tempdocs.cakephp.org/ :

"The set() method also takes an associative array as its first parameter.
This can often be a quick way to assign a set of information to the view.
Note that your array keys will be inflected before they get assigned to the
view ('underscored_key' becomes 'underscoredKey', etc.):"

Perhaps the reason is,
Array keys may have underscored names (often we get array from models/tables
and usually table fields have underscored names)
And we commonly use camelCased variable names in our views/controllers. So,
to make this transition smooth I think it is done in this way..


On Jan 31, 2008 1:16 PM, Steven Chan <[EMAIL PROTECTED]> wrote:
>
> Hi Anupom,
>
> Yes, I am talking about that.If you set my_name using an associative
> array ie. $this->set(array('my_name' => false)) then you get $myName
> whereas if you set  $this->set('my_name',false) then you get $my_name
>
> Why is there this inconsistency?
>
>
> On Jan 31, 2:58 pm, Anupom <[EMAIL PROTECTED]> wrote:
> > $my_array    = array (
> >                     'my_name'   => 'James Bond,
> >                     'dob' => '2007/09/09'
> >                   );
> >
> > $this->set($my_array);
> >
> > This will set two view variables with names $myName and $dob. It works
> > perfectly here.
> >
> > BTW, are you talking about this one? Your question is pretty unclear.
> >
>
> > On Jan 31, 2008 12:35 PM, Steven Chan <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > > Hi all,
> >
> > > I was just using the latest beta version of cake 1.2 and noticed that
> > > the Controller::set() function variableizes the variable names if
> > > given an array but doesn't when it's given 2 arguments. Is this a bug?
> >
> > --
>
> > Thanks
> > Anupom
> > Trippert Inc. [http://www.trippert.com]
> > GopherNow. [http://www.gophernow.com/]
> > Homepage. [http://www.anupom.wordpress.com/]
>
>
>
> >
>



-- 
Thanks
Anupom
Trippert Inc. [http://www.trippert.com]
GopherNow. [http://www.gophernow.com/]
Homepage. [http://www.anupom.wordpress.com/]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to