/** * @param $resultSet * @return BlacklistEntry * @version 2015062901 * @since 2015062901 */ private function resultSetToEntity($resultSet) { $entities = array(); foreach ($resultSet as $id => $result) { $entity = new BlacklistEntry(); $entity->setId($id); $entity->setAccountId($result->accountId); $entity->setPhoneNumber($result->phone_number); $entity->setIsBlacklisted($result->is_blacklisted); $entities[$id] = $entity; } return $entities; }
/** * @param array $blacklistedNumbers * @param TxttoolsAccount $account * @version 2015062901 * @since 2015062901 */ private function syncDbWithResponse($blacklistedNumbers, $account) { $blacklistEntries = array(); foreach ($blacklistedNumbers as $number => $status) { $blacklistEntry = new BlacklistEntry(); $blacklistEntry->setPhoneNumber($number); $blacklistEntry->setIsBlacklisted(BlacklistDAO::$BLACKLISTED); $blacklistEntry->setAccountId($account->getId()); $blacklistEntries[] = $blacklistEntry; } $this->blacklistDAO->removeAllBlacklistEntriesForAccount($account->getId()); $this->blacklistDAO->saveBlacklistEntries($blacklistEntries); }