예제 #1
0
 /**
  * Filtered phone by phone number from contact and return entity or null
  *
  * @param Contact      $contact
  * @param ContactPhone $contactPhone
  *
  * @return ContactPhone|null
  */
 protected function getContactPhoneFromContact(Contact $contact, ContactPhone $contactPhone)
 {
     foreach ($contact->getPhones() as $phone) {
         if ($phone->getPhone() === $contactPhone->getPhone()) {
             $hash = spl_object_hash($phone);
             if (array_key_exists($hash, $this->processedEntities)) {
                 // skip if contact phone used for previously imported phone
                 continue;
             }
             $this->processedEntities[$hash] = $phone;
             return $phone;
         }
     }
     return null;
 }