I am new to cakephp. I am usign query builder to fetch details from two tables using join in cakephp query builder.But the query i am writing is fetching details only from one table. Need help to get data from other table as well.
This is my code to fetch data by joining two tables:
public function edit($id = null) {
$events_table = TableRegistry::get('Events');
$events = $events_table->find('all')
->hydrate(false)
->join([
'CourseType'=> [
'table' => 'coursetype',
'type' => 'LEFT',
'conditions' => 'Events.type = CourseType.coursetype_id',
]
])->where(['Events.id' => $id]);
$event = $events->toArray();
$this->set('event', $event);
}
As a result i am getting only details from events table. But i need data from coursetype also.Any help is appreciated. Thank you.