- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
$masterContacts = $masterClient->getContacts();
for ($i=0; $i < count($masterContacts); $i++) {
for ($j=$i+1; $j < count($masterContacts); $j++) {
if(!(strcmp($masterContacts[$i]->getFirstName(), $masterContacts[$j]->getFirstName()) && strcmp($masterContacts[$i]->getLastName(), $masterContacts[$j]->getLastName()))){
echo $masterContacts[$i]->getFirstName() . ", " . $masterContacts[$i]->getLastName() . "==" . $masterContacts[$i]->getFirstName() . ", " . $masterContacts[$i]->getLastName() . "\n";
foreach ($masterContacts[$i]->getFields() as $contact_i) {
$contact_i->setContact($masterContacts[$j]);
// $masterContacts[$i]->removeField($contact_i);
// $masterContacts[$j]->addField($contact_i);
}
$em->remove($masterContacts[$i]);
// $masterClient->removeContact($masterContacts[$i]);
break;
}
}
}
foreach ($masterContacts as $masterContact) {
for ($i=0; $i < count($masterContact->getFields()); $i++) {
$field_i = $masterContact->getFields()[$i];
foreach ($masterContacts as $masterContact) {
for ($j=$i+1; $j < count($masterContact->getFields()); $j++) {
$field_j = $masterContact->getFields()[$j];
// if(!strcmp($masterContact->getFields()[$i]->getInn(), $masterContact->getFields()[$j]->getInn())){
if(!strcmp($field_i->getXValue(), $field_j->getXValue())) {
// echo "compare :" . $field_i->getXValue() . " == " . $field_j->getXValue();
$em->remove($field_i);
break;
}
}
}
}
}
// echo $masterClient->getId();
$mOrganizations = $masterClient->getOrganization();
for ($i=0; $i < count($mOrganizations); $i++) {
for ($j=$i+1; $j < count($mOrganizations); $j++) {
if(!strcmp($mOrganizations[$i]->getInn(), $mOrganizations[$j]->getInn())){
echo "compare :" . $mOrganizations[$i]->getInn() . " == " . $mOrganizations[$j]->getInn();
$em->remove($mOrganizations[$i]);
break;
}
}
}