Hi all,
using ORM for the first time and I'm having trouble getting my associations
all worked out. I'm unable to get my associated table data to save.Here's a
basic overview of my models:
Locations -> Parent
Rentals -> Belongs to Locations
Rates -> Belongs to Rentals
My code looks like this:
<?php
class Rental extends AppModel
{
var $name = 'Rental';
var $hasOne = array(
'Rate' => array(
'className' => 'Rate',
'dependent' => true
)
);
var $belongsTo = array(
'Location' => array(
'className' => 'Location',
'fields' => 'city'
)
);
}
?>
class Rate extends AppModel
{
var $name = 'Rate';
var $belongsTo = 'Rentals';
}
And my save looks like this:
$this->Rental->saveAll($this->data)
However only data to the Rental table is being saved and not to the Rate
table. Can anyone tell me what I am missing. I don't have a controller for
Rates as there are no direct functions to run against them, does this
matter?
Thanks.
--
View this message in context:
http://old.nabble.com/Unable-to-save-related-table-information-tp27153345p27153345.html
Sent from the CakePHP mailing list archive at Nabble.com.
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