/** * Create contact record for message * @return Entity $contact */ protected function getContactEntity() { // Is the sender of the message a registered contact? $contact = $this->contactRepo->getByContact($this->getPayload('from'), $this->getPayload('contact_type')); if (!$contact->getId()) { $contact = $this->contactRepo->getEntity()->setState(['contact' => $this->getPayload('from'), 'type' => $this->getPayload('contact_type'), 'data_provider' => $this->getPayload('data_provider')]); } return $contact; }
/** * Create contact record for message * @return Entity $contact */ protected function getContactEntity() { // Is the sender of the message a registered contact? $contact = $this->contactRepo->getByContact($this->getPayload('from'), $this->getPayload('contact_type')); if (!$contact->getId()) { // this is the first time a message has been received by this number, so create contact $contact = $this->contactRepo->getEntity()->setState(['contact' => $this->getPayload('from'), 'type' => $this->getPayload('contact_type'), 'data_provider' => $this->getPayload('data_provider')]); } return $contact; }