Hi Folks,

I Have the following:

Transaction hasMany ArticlesTransaction
Transaction belongsTo Address

ArticlesTransaction belongsTo Article
ArticlesTransaction belongsTo Transaction
ArticlesTransaction belongsTo Shipping

(and some other Associations)

and want to save the following with Transaction->saveAll()

Array
(
    [Address] =>  Array
        (
            [firstname] =>  Peter
            [secondname] =>  Lustig
            [street] =>  bananenstr. 123
            [town] =>  Bierlin
            [postcode] =>  12345
            [country_id] =>  11
        )

    [Transaction] =>  Array
        (
            [user_id] =>  3
            [state] =>  confirmed
        )

    [ArticlesTransaction] =>  Array
        (
            [0] =>  Array
                (
                    [article_id] =>  1
                    [quantity] =>  3
                    [shipping_id] =>  6
                )

            [1] =>  Array
                (
                    [article_id] =>  2
                    [quantity] =>  2
                    [shipping_id] =>  4
                )

            [2] =>  Array
                (
                    [article_id] =>  3
                    [quantity] =>  2
                    [shipping_id] =>  4
                )

        )

)

But saveAll fails and the following is in $this->Transaction->validationErrors

Array
(
    [ArticlesTransaction] =>  Array
        (
            [0] =>  Array
                (
                    [transaction_id] =>  numeric
                )

            [1] =>  Array
                (
                    [transaction_id] =>  numeric
                )

            [2] =>  Array
                (
                    [transaction_id] =>  numeric
                )

        )

)

When I comment out validation on ArticlesTransaction->transaction_id, 
everything gets saved perfectly fine. (With transaction_id set to the saved 
Transaction) Is it normal that ArticlesTransaction gets validated before 
transaction_id is set? How can I avoid disabling validation? Am I doing something 
wrong?
I hope I provided enough info to understand my problem.

Cheers
Max

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to