Imagine three models...Event , Venue, and EventType. Currently, Event
belongsTo Venue. Each event has a specific venue at which it will
occur. If i nav to events/view/2, i get the expected Event object and
it's Venue object. Great.
It makes since in my mind that each EventType hasMany Event(s). If i
nav to types/view/2, again, i get the correct Event(s) associated to
that EventType.
My problem is, when i pull a specific EventType, i don't get the venue
object associated to the Event object. I get the related events, but i
had hoped the Venue for which that Event occurs would also be bound to
that specific Event. I am not sure what code you will need, but i can
give anything...we can start with the Model for Type, and Event
//Type Model
<?php
class Type extends AppModel {
var $name = 'Type';
var $hasMany = array(
"Event"=>array(
"foreignKey"=>"event_type",
"order"=>array("date"=>"asc","start_time"=>"asc")
)
);
}
?>
//EVENT model
<?php
class Event extends AppModel {
var $name = 'Event';
var $belongsTo=array(
"Venue"=>array(
"foreignKey"=>"venue"
),
"Type"=>array(
"foreignKey"=>"event_type"
)
);
}
?>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment