Skip to content

Commit

Permalink
Rimosso TagLoop
Browse files Browse the repository at this point in the history
  • Loading branch information
HighLiuk committed Oct 7, 2021
1 parent c6ee000 commit dd28e2d
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions src/Contacts/Contacts.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,35 +97,6 @@ public function createWithAccount(array $contact, string $accountID)
$this->addContactToAccount($contactID, $accountID);
}

/**
* Tagga un blocco di contatti con una lista di tag
*
* Manda più richieste bulk per importare i contatti aggiungendo anche dei tag
*/
public function tagLoop(array $contacts = [], array $tags = [], int $contacts_per_page = 250)
{
// per fare dei test: altrimenti due richieste identiche ravvicinate tirano un errore 400
// shuffle($contacts);

// preparo i dati da mandare, composti da email + tag
$contacts = array_map(
fn($contact) => [
'email' => $contact['email'],
'tags' => $tags,
],
$contacts
);

$chunks = array_chunk($contacts, $contacts_per_page);
$chunks_num = count($chunks);

// Loop sui chunk
foreach ($chunks as $key => $chunk) {
$this->bulkImport($chunk);
dump('Aggiunti Tag ' . ($key + 1) . ' / ' . $chunks_num);
}
}

/**
* Bulk Import Contacts
*
Expand Down

0 comments on commit dd28e2d

Please sign in to comment.