I need help to understand the following code. What I want to know is the code line in the set_query($data,$limit_enable). If any help regarding the matter would be highly appreciated.
function get_data($data){
$out = array();
$this->set_query($data,$limt_enabled);
//some code
}
function set_query($data,$limit_enable){
$data['selection'] = isset($data['selection'])? $data['selection']: 'task_master.staff_id,staff.full_name,creator_staff.full_name AS creator' ;
//some code
}
Actually $this->set_query($data,$limt_enabled);
is calling the set_query()
method of this same class and set_query()
has one ternary expression which is
$data['selection'] = isset($data['selection'])? $data['selection']: 'task_master.staff_id,staff.full_name,creator_staff.full_name AS creator' ;
It means
if( isset($data['selection']) )
{
$data['selection'] = $data['selection'];
}
else
{
$data['selection'] = 'task_master.staff_id,staff.full_name,creator_staff.full_name AS creator'
}
I'm not sure from which framework
you have got it but it looks like that, if already $data['selection']
is not set for selection from table then set the selection criterion something like
select task_master.staff_id, staff.full_name, creator_staff.full_name
Which is actually going to be used for selecting some table fields and these are
staff_id field from table `task_master
full_name field from table `staff
full_name field from table `creator_staff
Also it's setting an alias for this selection AS creator
.