public static function register($entityTypeID, $entityID, $title, $isRaw = true)
 {
     if (!is_int($entityTypeID)) {
         throw new Main\ArgumentTypeException('entityTypeID', 'integer');
     }
     if (!is_int($entityID)) {
         throw new Main\ArgumentTypeException('entityID', 'integer');
     }
     if (!is_string($title)) {
         throw new Main\ArgumentTypeException('title', 'string');
     }
     self::unregister($entityTypeID, $entityID);
     if ($isRaw) {
         $title = self::prepareCode($title);
     }
     if ($title === '') {
         return;
     }
     DuplicateOrganizationMatchCodeTable::add(array('ENTITY_TYPE_ID' => $entityTypeID, 'ENTITY_ID' => $entityID, 'TITLE' => $title));
     $matches = array('TITLE' => $title);
     DuplicateEntityMatchHash::unregisterEntity($entityTypeID, $entityID, DuplicateIndexType::ORGANIZATION);
     DuplicateEntityMatchHash::register($entityTypeID, $entityID, DuplicateIndexType::ORGANIZATION, self::prepareMatchHash($matches), true);
 }
 public static function register($entityTypeID, $entityID, $lastName, $name, $secondName, $isRaw = true)
 {
     if (!is_int($entityTypeID)) {
         throw new Main\ArgumentTypeException('entityTypeID', 'integer');
     }
     if (!is_int($entityID)) {
         throw new Main\ArgumentTypeException('entityID', 'integer');
     }
     if (!is_string($lastName)) {
         throw new Main\ArgumentTypeException('lastName', 'string');
     }
     if (!is_string($name)) {
         throw new Main\ArgumentTypeException('name', 'string');
     }
     if (!is_string($secondName)) {
         throw new Main\ArgumentTypeException('secondName', 'string');
     }
     if ($isRaw) {
         $lastName = self::prepareCode($lastName);
         $name = self::prepareCode($name);
         $secondName = self::prepareCode($secondName);
     }
     self::unregister($entityTypeID, $entityID);
     if ($lastName !== '') {
         DuplicatePersonMatchCodeTable::add(array('ENTITY_TYPE_ID' => $entityTypeID, 'ENTITY_ID' => $entityID, 'NAME' => $name, 'SECOND_NAME' => $secondName, 'LAST_NAME' => $lastName));
         $matches = array('LAST_NAME' => $lastName);
         if ($name !== '') {
             $matches['NAME'] = $name;
         }
         if ($secondName !== '') {
             $matches['SECOND_NAME'] = $secondName;
         }
         DuplicateEntityMatchHash::unregisterEntity($entityTypeID, $entityID, DuplicateIndexType::PERSON);
         DuplicateEntityMatchHash::register($entityTypeID, $entityID, DuplicateIndexType::PERSON, self::prepareMatchHash($matches), true);
         if (isset($matches['SECOND_NAME'])) {
             unset($matches['SECOND_NAME']);
             DuplicateEntityMatchHash::register($entityTypeID, $entityID, DuplicateIndexType::PERSON, self::prepareMatchHash($matches), false);
         }
         if (isset($matches['NAME'])) {
             unset($matches['NAME']);
             DuplicateEntityMatchHash::register($entityTypeID, $entityID, DuplicateIndexType::PERSON, self::prepareMatchHash($matches), false);
         }
     }
 }
 public static function register($entityTypeID, $entityID, $type, array $values, $isRaw = true)
 {
     if (!is_int($entityTypeID)) {
         throw new Main\ArgumentTypeException('entityTypeID', 'integer');
     }
     if (!is_int($entityID)) {
         throw new Main\ArgumentTypeException('entityID', 'integer');
     }
     if (!is_string($type)) {
         throw new Main\ArgumentTypeException('type', 'string');
     }
     if ($isRaw) {
         $values = self::prepareCodes($type, $values);
     }
     DuplicateCommunicationMatchCodeTable::replaceValues($entityTypeID, $entityID, $type, $values);
     $typeID = DuplicateIndexType::UNDEFINED;
     if ($type === 'PHONE') {
         $typeID = DuplicateIndexType::COMMUNICATION_PHONE;
     } elseif ($type === 'EMAIL') {
         $typeID = DuplicateIndexType::COMMUNICATION_EMAIL;
     }
     if ($typeID !== DuplicateIndexType::UNDEFINED) {
         DuplicateEntityMatchHash::unregisterEntity($entityTypeID, $entityID, $typeID);
         foreach ($values as $value) {
             $matches = array('TYPE' => $type, 'VALUE' => $value);
             DuplicateEntityMatchHash::register($entityTypeID, $entityID, $typeID, self::prepareMatchHash($matches), true);
         }
     }
 }