$d = OppSimilaritaPeer::retrieveByPK($politici[$i]['id'], $politici[$j]['id']); if (is_null($d)) { $d = new OppSimilarita(); $d->setCaricaFromId($politici[$i]['id']); $d->setCaricaToId($politici[$j]['id']); } $d->setSigningSimilarity(OppSimilaritaPeer::similarityForSignatures($politici[$i], $politici[$j]) / $ncariche); $d->save(); // scrittura elemento simmetrico $ds = OppSimilaritaPeer::retrieveByPK($politici[$j]['id'], $politici[$i]['id']); if (is_null($ds)) { $ds = new OppSimilarita(); $ds->setCaricaFromId($d->getCaricaToId()); $ds->setCaricaToId($d->getCaricaFromId()); } $ds->setSigningSimilarity($d->getSigningSimilarity()); $ds->save(); $ds = null; unset($ds); $d = null; unset($d); } print "."; if ($i > 0 && $i % 10 == 0) { print "{$i}/{$ncariche} "; } if ($i > 0 && $i % 50 == 0) { print "\n"; } } echo "done\n";