Skip to content

Instantly share code, notes, and snippets.

@roderik
Created October 25, 2013 21:42
Show Gist options
  • Save roderik/7162274 to your computer and use it in GitHub Desktop.
Save roderik/7162274 to your computer and use it in GitHub Desktop.
$contact = $dm->createQueryBuilder('KunstmaanPeerPressureDMBundle:Contact')
->field('address')->equals($row[2])
->field('zipcode')->equals((string)$row[3])
->getQuery()
->getSingleResult();
if (!$contact) {
$contact = new Contact();
$contact->setLastname($row[1]);
$contact->setAddress($row[2]);
$contact->setZipcode($row[3]);
$contact->setCity($row[4]);
$contact->setCountry($row[5]);
$contact->setLanguage($row[6]);
$contact->setCustomer(true);
$dm->persist($contact);
$dm->flush();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment