BelongsTo not working properly
Hello,
I have two tables like this:
CREATE TABLE IF NOT EXISTS `test123`.`rooms` (
`id` INT NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(255) NULL ,
`capacity` INT NULL ,
PRIMARY KEY (`id`) )
ENGINE = InnoDB;
CREATE TABLE IF NOT EXISTS `test123`.`room_times` (
`id` INT NOT NULL AUTO_INCREMENT ,
`room_id` INT NOT NULL ,
`starttime` TIME NULL ,
`endtime` TIME NULL ,
`dayofweek` ENUM('MONDAY', 'TUESDAY', 'WEDENSDAY', 'THURSDAY',
'FRIDAY', 'SATURDAY', 'SUNDAY') NULL ,
PRIMARY KEY (`id`) ,
INDEX `fk_room_times_rooms1` (`room_id` ASC) ,
CONSTRAINT `fk_room_times_rooms1`
FOREIGN KEY (`room_id` )
REFERENCES `test123`.`rooms` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
The room_time.php model is like this:
<?php
class RoomTime extends AppModel {
var $name = 'RoomTime';
//The Associations below have been created with all possible keys,
those that are not needed can be removed
var $belongsTo = array(
'Room' => array(
'className' => 'Room',
'foreignKey' => 'room_id',
'conditions' => '',
'fields' => '',
'order' => ''
)
);
}
?>
The problem is that the rooms does not appear in the drop down list
when i tries to create a room_time(Using default generated views). Is
something wrong with the belongsTo setup?
Thanks for any help, Struggled with this for hours!
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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home