diff --git a/src/Service/MQTTClient.php b/src/Service/MQTTClient.php index fc1d1493..7d580a79 100644 --- a/src/Service/MQTTClient.php +++ b/src/Service/MQTTClient.php @@ -35,6 +35,7 @@ class MQTTClient public function sendEvent(JobOrder $job_order, $payload) { + error_log("CUSTOMER ID: " . $job_order->getCustomer()->getID()); //error_log('sending mqtt event: '); //error_log(print_r($payload, true)); @@ -44,16 +45,19 @@ class MQTTClient $new_sessions = []; $cust_user = $job_order->getCustomer()->getCustomerUser(); if (!empty($cust_user)) { + error_log("CUSTOMER USER ID: " . $cust_user->getID()); $new_sessions = $cust_user->getMobileSessions(); } // TODO: make this more elegant. looping through each instead of merging the two because doctrine returns PersistentCollection if empty, and array if not $sessions = []; foreach ($legacy_sessions as $sess) { + error_log("FOUND LEGACY SESSION: " . $sess->getID()); $sessions[] = $sess; } foreach ($new_sessions as $sess) { + error_log("FOUND NEW SESSION: " . $sess->getID()); $sessions[] = $sess; } @@ -71,6 +75,8 @@ class MQTTClient $phone_num = $sess->getPhoneNumber(); $channel = self::PREFIX . $phone_num; + error_log("SENDING TO CHANNEL: " . $channel); + // gather channels, so we only send once $channels[$channel] = json_encode($payload); }