I have a function defined in one mapper let's say abcMapper and I want that function to be called in another mapper let's say xyzMapper, how should I do this?
I have tried calling function using
$this->abcMapper->functionName();
but doesn't work that way
How do I solve this? Suggest any methods.
Edit:-
class abcMapper{
public function functionName(){
$studentSelect = "select query;
$studnetResult = $this->dbAdapter->query($studentSelect, array());
$response = array();
foreach ($studnetResult as $value) {
$sqlInsert = "insert query";
$resultInsert = $this->dbAdapter->query($sqlInsert, array());
$lastInsertId = $this->dbAdapter->getDriver()->getLastGeneratedValue();
$value["url"] = "http://www.example.com/home?notification?id=".$lastInsertId;
ignore_user_abort();
ob_start();
$fields = array(
'to' => $value["token"],
'data' => $value,
);
$headers = array(
'Authorization: "key"'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, 'https://fcm.googleapis.com/fcm/send');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
$result = json_decode(curl_exec($ch), true);
array_push($response, [
"id" => $value["sid"],
"rollNo" => $value["rollNo"]
]);
curl_close($ch);
ob_flush();
}
}
}
This is the function, which is being called.
class xyzMaper implements xyzMaperInterface{
public function insert(){
$this->xyz->functionName();
}
}
Thanks in advance
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…