HI i never faced this type of problem. Please clarify me when i did wrong. I tried to generate 2 model which have relation but it didn't come in models. Here are the Db structure.
CREATE TABLE IF NOT EXISTS `property` (
`property_id` int(11) NOT NULL AUTO_INCREMENT,
`ListPrice` int(11) NOT NULL,
`ListingURL` text NOT NULL,
`ProviderName` varchar(255) NOT NULL,
`ProviderURL` text NOT NULL,
`modificationTimestamp` text NOT NULL,
PRIMARY KEY (`property_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
CREATE TABLE IF NOT EXISTS `location` (
`loc_id` int(11) NOT NULL AUTO_INCREMENT,
`property_id` int(11) NOT NULL,
`latitude` varchar(255) NOT NULL DEFAULT '0.0000',
`longitude` varchar(255) NOT NULL DEFAULT '0.0000',
PRIMARY KEY (`loc_id`),
KEY `property_id` (`property_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
--
-- Constraints for table `location`
--
ALTER TABLE `location`
ADD CONSTRAINT `location_ibfk_1` FOREIGN KEY (`property_id`)
REFERENCES `property` (`property_id`) ON DELETE CASCADE ON UPDATE CASCADE;
In model no relation in there :
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
);
}