Have you tried using Containable? It's much usually easier to work
with than relying on 'recursive'.

On Wed, Jul 8, 2009 at 11:08 AM, iFeghali<[email protected]> wrote:
>
> Hello All,
>
> I am stuck at a circular relationship problem. This is my scenario:
>
> - Machine HABTM Service HABTM Machine
> - Machine belongsTo Type hasMany Machine
> - Machine belongsTo Category hasMany Machine
> - Service belongsTo Customer hasMany Service
>
> So far so good. When the user goes to /machine/view it expects to see:
>
> [level 0] machine
> [level 1] machine type
> [level 1] machine category
> [level 1] services
> [level 2] services customers
>
> If I set recursive to 1, the last item will not be retrieved. If i set
> recursive to 2, everything goes well except I get machine records for
> type, category and services (too much unwanted data).
>
> I could let recursive = 2 and manually unbind machine from all other
> models in the view action, but that would be too much extra code for
> something apparently simple. note that the given scenario is just an
> exemplification, my real case has around 8 models tied on a complex
> "web".
>
> I could also made relationships one way only, but obviously it would
> break the views for the other models.
>
> so my question is whether i can set recursive to 2, but tells cake not
> to retrieve the main model thus preventing "circular data".
>
> Thank you.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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