/** * @param string $name * @param string $email * @param int $idUser * @return bool */ function ExistAddressBookRecordDoublet($name, $email, $idUser) { if (!$this->_dbConnection->Execute($this->_commandCreator->SelectAddressBookRecordsByNameEmail($name, $email, $idUser))) { return false; } $existDoublet = false; while (false !== ($row = $this->_dbConnection->GetNextRecord())) { $primaryEmail = null; switch ($row->primary_email) { case PRIMARYEMAIL_Home: $primaryEmail = $row->h_email; break; case PRIMARYEMAIL_Business: $primaryEmail = $row->b_email; break; case PRIMARYEMAIL_Other: $primaryEmail = $row->other_email; break; } if ($primaryEmail == $email && $primaryEmail !== null) { $existDoublet = true; break; } } return $existDoublet; }