Re: Why doesn't Find* return a group of model objects?

2008-01-04 Thread gwoo

Speed, simplicity, clarity. We feel that a model object in the view
will only result in misuse. We have helpers that allow you to handle
the arrays any way you need, as well as various callbacks to allow you
to format the data that comes back from the model. The benefits to
having a model object available in the view seem small, while the
potential problems and heft of moving those objects around seem much
larger.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Why doesn't Find* return a group of model objects?

2008-01-04 Thread Deane

My firm is new to CakePHP, and we're struggling with a piece of Cake
Theory.  Perhaps you can help --

When you do a Find or a FindAll, why do you get back a big, nested
array?  When I do Widget-FindAll() why do I not get back an array of
Widget objects?  Isn't that what a model is for?

We want to use models in our views.  So we can write a method on our
model, and then call that in a view to do something.

This seems conceptually correct to us, and we can't understand the
point of having a model then forcing developers to work with nested
array structures that have no relationship to the models they're
supposed to represent.

Can anyone explain this to us?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Why doesn't Find* return a group of model objects?

2008-01-04 Thread gwoo

Everyone is entitled to their opinion and their choice of frameworks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Why doesn't Find* return a group of model objects?

2008-01-04 Thread Deane

Thanks for the reply.  We couldn't disagree more strenuously, and we
think you're wrong beyond belief in your reasoning, but we appreciate
the response.

Deane


On Jan 4, 10:17 am, gwoo [EMAIL PROTECTED] wrote:
 Speed, simplicity, clarity. We feel that a model object in the view
 will only result in misuse. We have helpers that allow you to handle
 the arrays any way you need, as well as various callbacks to allow you
 to format the data that comes back from the model. The benefits to
 having a model object available in the view seem small, while the
 potential problems and heft of moving those objects around seem much
 larger.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Why doesn't Find* return a group of model objects?

2008-01-04 Thread nate

Your opinion is wrong.
   - Nate Abele, 2007

On Jan 4, 12:11 pm, Deane [EMAIL PROTECTED] wrote:
 Thanks for the reply.  We couldn't disagree more strenuously, and we
 think you're wrong beyond belief in your reasoning, but we appreciate
 the response.

 Deane

 On Jan 4, 10:17 am, gwoo [EMAIL PROTECTED] wrote:

  Speed, simplicity, clarity. We feel that a model object in the view
  will only result in misuse. We have helpers that allow you to handle
  the arrays any way you need, as well as various callbacks to allow you
  to format the data that comes back from the model. The benefits to
  having a model object available in the view seem small, while the
  potential problems and heft of moving those objects around seem much
  larger.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Why doesn't Find* return a group of model objects?

2008-01-04 Thread rtconner

One time gwoo wrote some quick code that would make find return
objects instead of arrays. I turned it into a behavior. Seemed to work
pretty well at the time. It should still work (not sure though,
because of all the recent changes to cake core). Give it a try.

http://bin.cakephp.org/saved/24245

In any case there are ways to get things to behave the way you want
them with Objects being returned. Cake (for the most part) is flexible
like that.

On Jan 4, 12:11 pm, Deane [EMAIL PROTECTED] wrote:
 Thanks for the reply.  We couldn't disagree more strenuously, and we
 think you're wrong beyond belief in your reasoning, but we appreciate
 the response.

 Deane

 On Jan 4, 10:17 am, gwoo [EMAIL PROTECTED] wrote:

  Speed, simplicity, clarity. We feel that a model object in the view
  will only result in misuse. We have helpers that allow you to handle
  the arrays any way you need, as well as various callbacks to allow you
  to format the data that comes back from the model. The benefits to
  having a model object available in the view seem small, while the
  potential problems and heft of moving those objects around seem much
  larger.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Why doesn't Find* return a group of model objects?

2008-01-04 Thread nate

Oh, and Deane, I forgot to ask: is that the royal we or the
managerial we?

On Jan 4, 12:11 pm, Deane [EMAIL PROTECTED] wrote:
 Thanks for the reply.  We couldn't disagree more strenuously, and we
 think you're wrong beyond belief in your reasoning, but we appreciate
 the response.

 Deane

 On Jan 4, 10:17 am, gwoo [EMAIL PROTECTED] wrote:

  Speed, simplicity, clarity. We feel that a model object in the view
  will only result in misuse. We have helpers that allow you to handle
  the arrays any way you need, as well as various callbacks to allow you
  to format the data that comes back from the model. The benefits to
  having a model object available in the view seem small, while the
  potential problems and heft of moving those objects around seem much
  larger.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Why doesn't Find* return a group of model objects?

2008-01-04 Thread b logica
On Jan 4, 2008 4:28 PM, nate [EMAIL PROTECTED] wrote:


 Oh, and Deane, I forgot to ask: is that the royal we or the
 managerial we?

 On Jan 4, 12:11pm, Deane [EMAIL PROTECTED] wrote:
  Thanks for the reply. We couldn't disagree more strenuously, and we
  think you're wrong beyond belief in your reasoning, but we appreciate
  the response.



I think that was explained from the beginning:

 My firm is new to CakePHP, and we're struggling with ...

 I too initially was skeptical of the lack of objects returned. However,
after a few days poking around, I'm pretty satisfied with the way things
work. Not having access to object methods in the view doesn't seem all that
big a deal considering that it's really not the place to be altering data
and any data that's required can be added to the array in the controller if
not placed there already by find() and friends.

brian

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Why doesn't Find* return a group of model objects?

2008-01-04 Thread Robby Anderson


I'd also add this: while its not strictly OO behavior, I like the fact
that Model searches return pure data, and not other models/objects.

It helps reinforce the viewpoint of having the view incapable of
performing any meaningful business logic. If model returned other
models and those were passed to your views, it would be way too
temping to access methods of those models (which would likely have
business logic behind them) ... and suddenly meaningful business logic
is quickly and easily introduced into the view. Instead, those desired
model methods should be encapsulated into more generic helpers for
your view (or specific ones, if you have very specific data
manipulation relevant only to a single model), and accessed that way.
Sure, you _could_ put business logic in your helpers, but that is
conscious design decision to break convention - as opposed to an
unconscious design decision to access business-logic methods that are
in the models you desire to pass to your views.

Obviously YMMV, but as others have stated, its relatively easy enough
to change the default behavior to align with your needs. So far my
limited use of Cake has led to to believe that the designers have
erred on the side of enforcing convention (both syntactic and
design) whenever possible. And so far, I don't disagree with the
convention, so I like the design choices. :) But if/when I do, I won't
have an issues changing the default behavior to match my preference/
need.

-r

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Why doesn't Find* return a group of model objects?

2008-01-04 Thread Adam Royle

I can't wait until Christian (Jippy) does his soap opera dissection
of this thread in next weeks' CakePHP weekly summaries :)

On Jan 5, 1:05 pm, Deane [EMAIL PROTECTED] wrote:
 Gwoo:

 Let me retract my remarks.  I was frustrated, and what I wrote was
 insulting.

 You have my apologies.

 Deane

 On Jan 4, 11:27 am, gwoo [EMAIL PROTECTED] wrote:

  Everyone is entitled to their opinion and their choice of frameworks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---