I'm with WebbedIT on this one. And besides, you can always do something like the following in your controller:
$data = $this->Article->read(null, $id); $article = $data['Article']; $this->set(compact("article", "data")); and access $article['name'] etc. in your view. On Mar 24, 7:52 pm, Lucas Costa <lucasrco...@gmail.com> wrote: > Hi. I've been working with Cake for a while and something always comes > up to my mind when writing a view, which I'll share: > > We all know how Cake spits a simple find('first'), right: > > Array > ( > [ModelName] => Array > ( > [id] => 83 > [field1] => value1 > ) > [AssociatedModelName] => Array > ( > [id] => 1 > [field1] => value1 > ) > ) > > Now, I find it tiresome to have to type the ['ModelName'] everytime I > want to play with the data. And also sometimes it seems a little > redundant. For example: What do you usually do when finding an > article: > > $article = $this->Articles->findById(1); (using $data all the time > seems little intuitive for me since sometimes we have a lot of > different data shipping to the view) > > To get the name of the article we would use $article['Article'] > ['name']. See... article->Article->name. > > And I keep thinking that since, by convention, all model names are > CamelCased, and fieldnames are lowercased, and arrays are case > sensitive, usually, we wouldn't have a collision and then we would > have more beatiful data: > > $article['name']; > $article['Author']['name']; > and so forth.... > > so, what am I missing here? :-) Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.