I've been stuggling with this problem for a while now and have come to
a dead end. I could really do with some help.

First of all the associations are;

Quote -> hasMany -> Invoice
Invoice -> belongsTo - Quote

Invoice -> hasMany -> Invoiceitem
Invoiceitem -> hasOne-> Invoice

Quote ->  hasMany -> Quoteitem
Quoteitem->  hasOne -> Quote

With the array below what im trying to do is pull the Quote (which
I've done) but also the Quoteitems associated with it, however it's
only going to one level. Once I've done this I'd like at get Quoteitem
and invoice item in the same array.

Can anyone see why it's not pulling in the associated quote data? Is
it that my models are not correct or is there more to do in the
controller?

Any help or advice on this would be really great!

Thanks,
Mike.

Array
(
    [Invoice] => Array
        (
            [id] => 1
            [quo_id] => 136
            [date] => 2007/03/27
            [status] => unpaid
        )

    [Quote] => Array
        (
            [id] => 136
            [enq_id] => 499
            [notes] => notes
        )

    [Invoiceitem] => Array
        (
            [0] => Array
                (
                    [id] => 54
                    [inv_id] => 1
                    [item] => Deposit
                    [qty] => 1
                    [price] => 499
                    [total_price] => 499.00
                )

The quote select statement looks like this..

SELECT `Invoice`.`id`, `Invoice`.`quo_id`, `Invoice`.`date`,
`Invoice`.`status`, `Quote`.`id`, `Quote`.`enq_id`, `Quote`.`notes`,
FROM `invoices` AS `Invoice` LEFT JOIN `quotes` AS `Quote` ON
`Invoice`.`quo_id` = `Quote`.`id` WHERE 1 LIMIT 1

A QuoteItem looks like this...

[Quoteitem] => Array
        (
            [0] => Array
                (
                    [id] => 295
                    [quo_id] => 136
                    [item] =>
                    [qty] => 1
                    [price] => 400
                    [total_price] => 400
                )


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