I've been scratching my head for hours and can't figure out why this
doesn't work. Any help would be appreciated.
Projects hasMany Tasks
Projects hasMany Events
Projects belongsTo ProjectStatus
Tasks hasMany TaskVendors
Events hasMany EventVendors
TaskVendors belongsTo Vendors
EventVendors belongsTo Vendors
Tasks belongsTo TaskStatus
Events belongsTo EventStatus
I have two finds happening in the Vendor model:
$events = $this->EventVendor->find('all', array(
'conditions' => array(
'EventVendor.vendor_id' => $vendorId
),
'contain' => array(
'Event' => array(
'id', 'event', 'project_id', 'event_date',
'Project' => array(
'project', 'ProjectStatus.project_status'
)
)
)
));
and
$tasks = $this->TaskVendor->find('all', array(
'conditions' => array(
'TaskVendor.vendor_id' => $vendorId
),
'contain' => array(
'Task' => array(
'id', 'task', 'project_id', 'due_date',
'TaskStatus' => array(
'task_status'
),
'Project' => array(
'project', 'ProjectStatus.project_status'
)
)
)
));
The events one is working properly and returns something like
[0] => Array
(
[EventVendor] => Array
(
[id] => 5
[event_id] => 11
[vendor_id] => 1
[label] => mover
[notes] =>
)
[Event] => Array
(
[id] => 11
[event] => Pack Day
[project_id] => 11
[event_date] => Feb 25, 2010
[Project] => Array
(
[project] => OakCrest-123
[project_status_id] => 1
[ProjectStatus] => Array
(
[project_status] => Active
)
)
)
)
[1] => Array
(
[EventVendor] => Array
(
[id] => 7
[event_id] => 12
[vendor_id] => 1
[label] => mover
[notes] =>
)
[Event] => Array
(
[id] => 12
[event] => Move (full day)
[project_id] => 11
[event_date] => Feb 26, 2010
[Project] => Array
(
[project] => OakCrest-123
[project_status_id] => 1
[ProjectStatus] => Array
(
[project_status] => Active
)
)
)
)
but the tasks one isn't returning the deeper associations:
[0] => Array
(
[TaskVendor] => Array
(
[id] => 10
[task_id] => 2
[vendor_id] => 1
[label] => Mover
[notes] =>
)
[Task] => Array
(
[id] =>
[task] =>
[project_id] =>
[due_date] =>
)
)
[1] => Array
(
[TaskVendor] => Array
(
[id] => 12
[task_id] => 1
[vendor_id] => 1
[label] => mover
[notes] =>
)
[Task] => Array
(
[id] =>
[task] =>
[project_id] =>
[due_date] =>
)
)
Any clue why, or where I should look?
Thank you very much.
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