Hello
may I kindly ask a hint about why this works but if I do enable the JOIN it doesn't work anymore? (follows after the code)
PHP Code:
public function AjaxSearch($query)
{
if($query != '')
{
$this->like('email', $query);
$this->orLike('name', $query);
$this->orLike('subject', $query);
$this->orLike('custom', $query);
$this->orLike('note', $query);
// $this->join('dept', 'dept.id = ticket.dept_id');
$this->orderBy('lastactivity', 'DESC');
return $this->findAll(5);
}
return;
}
this works like a charm and I get the 5 rows of fetched data from my table. But in the table there is one column that is dept_id
which is just an .. id so a meaningless number
I need to JOIN the 'dept' table to bind that id to the corresponding dept name and looks obvious that my approach is wrong
Can you kindly hint about the right approach? Should be managed in the controller? Or can be done here in the model?
Thank you