Hi, I'm still struggling with saving information to related tables. I
have a form which updates info about a rental property and I have an
associated Rates table which holds data about the rental rates for the
property.

I've defined my relationship as :

Rental -> hasOne
Rate -> belongsTo

My save action looks like this:

$this->Rental->saveAll($this->data);

However this save action is creating a new entry in the Rates table
rather than updating the existing one. I'm pretty sure my form data is
in the correct format:

Array
(
    [Rental] => Array
        (
            [id] => 45
            [rental_code] => PDSSerena
            [location_id] => 19
            [rental_agent] =>
            [rental_meta_url] =>
            [rental_meta_title] =>
            [rental_meta_desc] =>
            [rental_meta_tags] =>
        )

    [Rate] => Array
        (
            [s1_title] => title 1
            [s1_day] => day 1
            [s1_week] =>
            [s1_month] =>
            [extra_info] =>
        )

)

Do I need to explicitly set the rental_id in my Rate form data, such
as:

[Rate] => Array
        (
            [rental_id] => 45
        )

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