Well seems like the simplest solution would be to add another
relationship to your schema:
Invoice=[HasOne]=> Customer
Customer=[HasMany]=>Invoices

I would add that the invoice model should contain a reference to a
customer anyway.  Should it not?

Regards,
Cook

On Mar 31, 1:53 pm, "MYRZ" <[EMAIL PROTECTED]> wrote:
> Hi guys,
>
> Say, i have multiple customers. Customers have each a number of
> projects running. In each project, their are several Tickets. And some
> tickets together form an Invoice.
>
> So you get:
>
> Customer=[HasMany]=>Projects=[HasMany]=>Tickets=[BelongsTo]=>Invoices
>
> Now, somehow i want to get all the invoices of the customer with the
> id $id. How should i do that? Just do
>
> $clients = $this->Client->findAll('Client.id = '.$id, NULL, NULL,
> NULL, NULL,4);
>
> , and overload my db, or is there an efficient way of doing this?
>
> Thanks in advance...


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