spot on mate!

in answer to your questions:

1.
- new version of the code yes
- old method (of arrays) employed yes
- I will go about putting in the new style now to see if that has any
impact (sorry i didn't do this before)

2. model relationship is as follows:

    /* belongs to */
    /* tree relationship with itself */
    var $hasOne = array(

        'EcomCategoryParent' => array(

            'className' => 'EcomCategory',
            'foreignKey' => 'parent_id'

        )

    );

    /* has many */
    var $hasMany = array(

        'EcomCategoryChild' => array(

            'className' => 'EcomCategory',
            'foreignKey' => 'parent_id'

        )

    );

    /* has and belongs to many */
    var $hasAndBelongsToMany = array(

        'EcomProduct' => array(

            'className' => 'EcomProduct',
            'joinTable' => 'ecom_categories_products'

        ),
        'EcomImage' => array(

            'className' => 'EcomImage',
            'joinTable' => 'ecom_categories_images'

        )

    );

3. you're absolutely right, findAllThreaded is gold for this purpose.
however, in this instance I require the following information

- path in tree to current category (for the purpose of bread crumbs)
- - currently I haven't figured out how to do this without calling
findAllThreaded from the very top

- information relating to the requested category
- - name, description, etc

- associated images of requested categories
- - however, I do not need associated images of any parent categories
(or categories above requested in tree)

- child categories
- - I only need one level down for this screen

- associated images of child categories

- products of requested category
- - and definitely not products of any other category as this will
become a real problem over time

now, all this is well and good., and since you've introduced me to
expects() i've been trying as much as possible to only request the
information i require. I can't figure out how to extract only the
information i require in this instance.

it seems that if i tell EcomCategoryParent to only expect Parents and
EcomCategoryChildren to only expect Images then that seems to indicate
to EcomCategory that it doesn't want products.

It could be down to my use of the old method.

Will try the new and let you know.

Thanks for your help on this one,
mikee

On 19/12/06, Mariano Iglesias <[EMAIL PROTECTED]> wrote:
>
> Ok, couple of questions for you:
>
> 1. Are you using the new version of the code with old style version of
> parameters (via array)? There were no bug fixes and new version (as I
> haven't yet encountered bugs on previous version), but just so it is easy
> for us to know what to debug.
>
> 2. How is your model relationship built?
>
> 3. Category -> CategoryChild sounds like a great thing for findAllThreaded,
> previously calling expects() to only let models you are interested be as
> results, did you consider this? From my side I use this to build an n-depth
> level tree of categories and I use expect not to obtain related data to each
> category and works like a charm.
>
> Let's try to see if we can nail it down. It's weird that you would get
> unexpected results as to model unbinding since the code makes use of
> unbindModel() to do the actual unbinding. If we can cover the above 3 points
> and you still have problems we'll debug expects() to see which models are
> actually getting unbinded.
>
> And I agree, better get this resolved now than having to deal with it later.
>
> -MI
>
> ---------------------------------------------------------------------------
>
> Remember, smart coders answer ten questions for every question they ask.
> So be smart, be cool, and share your knowledge.
>
> BAKE ON!
>
>
> -----Mensaje original-----
> De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
> de Mikee Freedom
> Enviado el: Lunes, 18 de Diciembre de 2006 04:06 p.m.
> Para: cake-php@googlegroups.com
> Asunto: Re: Keeping unbindModel out of your controllers
>
> One thing I noticed this morning, but haven't looked in to in any
> great detail, is that when using the old method I run in to problems
> if I have parent child relationship existing within the same Model.
>
> e.g. Categories having child categories
>
>
> >
>

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

Reply via email to