/** * Retrieve a logistician by ID. * @param int|string $id * @return Logistician */ public function get_logistician_by_id($id) { $logistician = new ModelTemplate('Logistician'); $logistician = $logistician->get_single('id', $id); if ($logistician) { // Add super class SMSUser fields to the Logistician instance. $smsUserCtr = new SMSUser_Controller(); // It should have super class fields, otherwise delete the instance. if ($smsUser = $smsUserCtr->get_smsuser_by_id($id)) { $logistician->add_field('telephone', $smsUser->telephone); } else { $logistician = null; } } return $logistician; }
/** * Retrieve single truck driver, specified by ID. * @param int|string $id * @return TruckDriver */ public function get_truck_driver_by_id($id) { $truckDriver = new ModelTemplate('TruckDriver'); $truckDriver = $truckDriver->get_single('id', $id); if ($truckDriver) { // Add super class SMSUser fields to the TruckDriver instance. $smsUserCtr = new SMSUser_Controller(); // It should have super class fields, otherwise delete the instance. if ($smsUser = $smsUserCtr->get_smsuser_by_id($id)) { $truckDriver->add_field('telephone', $smsUser->telephone); } else { $truckDriver = null; } } return $truckDriver; }