See http://manual.cakephp.org/chapter/models

and then look at Section 2 "findAll" takes recursive that limits the
depth
or look at Section 3 where model has "var $recursive" that limits it
as the default (overridden by calls like findAll, find, etc.).

HTH,

David Lloyd
--
lloydhome consulting
http://lloydhome.com

On Feb 12, 7:35 pm, "Christopher E. Franklin, Sr."
<[EMAIL PROTECTED]> wrote:
> Hello,
>
> How do I stop the return or query of associated data?  I can see this
> becoming a huge problem in the future.
>
> This is how I have things set up:
>
> I have 3 tables:
> -classifieds
> -categories
> -category_classified
>
> Classifieds $hasManyAndBelongsTo Categories
> Categories $hasManyAndBelongsTo Classifieds
> (I didn't know how else to set these up using $hasMany, etc)
>
> All of this works fine.  Here is where my problem comes in:
>
> I created a helper class that will generate a custom category menu.
> The links are not static but, rather dependant on which page you are
> on.
>
> In my ClassifiedsController I do, $this->Category->findAll().  This
> provides me with an array with which I want to pass to the helper to
> parse and generate the menu.
>
> The drawback I am seeing when I print_r the array returned by 
> $this->Category->findAll(), the array includes all the classifieds
>
> associated with the category.  So, I get an output like this:
>
> <snip>
> [12] => Array
>                 (
>                     [Category] => Array
>                         (
>                             [id] => 0950
>                             [name] => Rentals
>                         )
>
>                     [Classified] => Array
>                         (
>                             [0] => Array
>                                 (
>                                     [id] => 2
>                                     [user_id] => 1
>                                     [itemno] => 123
>                                     [acctcode] => 000000-000000
>                                     [category_id] => 0950
>                                     [start] => 2007-02-12
>                                     [end] => 2007-02-19
>                                     [editions] => A,B,D,Y
>                                     [specials] =>
>                                     [dispname] =>
>                                     [disptag] =>
>                                     [dispcols] => 0
>                                     [dispdepth] =>
>                                     [text] => This is another test
> classified
>                                 )
>
>                             [1] => Array
>                                 (
>                                     [id] => 3
>                                     [user_id] => 1
>                                     [itemno] => 111111
>                                     [acctcode] => 111111-222222
>                                     [category_id] => 0950
>                                     [start] => 2007-02-12
>                                     [end] => 2007-02-12
>                                     [editions] => A,B
>                                     [specials] =>
>                                     [dispname] =>
>                                     [disptag] =>
>                                     [dispcols] => 0
>                                     [dispdepth] =>
>                                     [text] => Blah, another test!
>                                 )
>
>                         )
>
>                 )
> </snip>
>
> As you can see, this is just two test classified ads but, I deal with
> thousands a week.  I am afraid that this association will slow down my
> site CONSIDERABLY.
>
> So, my question is, should I do a custom query() or should I make my
> associations in a different way?
>
> Please, leave some feed back on your thoughts on how you would set
> this up or, something I can do to limit what cake puts into the array.
>
> My ultimate goal with this helper is just to get an array of category
> names, not the actual ad associated with the category.
>
> Thanks for reading,
> Chris


--~--~---------~--~----~------------~-------~--~----~
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