public function initOrm()
{
$this->purgeDatabase();
$contact = new Contact();
$contact->setFirstName('Max');
$contact->setLastName('Mustermann');
$contact->setPosition('CEO');
$contact->setFormOfAddress(1);
$contact->setSalutation('Sehr geehrter Herr Dr Mustermann');
$this->contact = $contact;
$title = new ContactTitle();
$title->setTitle('MSc');
$contact->setTitle($title);
$position = new Position();
$position->setPosition('Manager');
$account = new Account();
$account->setLft(0);
$account->setRgt(1);
$account->setDepth(0);
$account->setName('Musterfirma');
$account1 = new Account();
$account1->setLft(0);
$account1->setRgt(1);
$account1->setDepth(0);
$account1->setName('Musterfirma');
$phoneType = new PhoneType();
$phoneType->setName('Private');
$phone = new Phone();
$phone->setPhone('123456789');
$phone->setPhoneType($phoneType);
$contact->addPhone($phone);
$emailType = new EmailType();
$emailType->setName('Private');
$email = new Email();
$email->setEmail('*****@*****.**');
$email->setEmailType($emailType);
$contact->addEmail($email);
$faxType = new FaxType();
$faxType->setName('Private');
$this->faxType = $faxType;
$fax = new Fax();
$fax->setFax('123654789');
$fax->setFaxType($faxType);
$contact->addFax($fax);
$country1 = new Country();
$country1->setName('Musterland');
$country1->setCode('ML');
$country2 = new Country();
$country2->setName('United States');
$country2->setCode('US');
$addressType = new AddressType();
$addressType->setName('Private');
$address = new Address();
$address->setStreet('Musterstraße');
$address->setNumber('1');
$address->setZip('0000');
$address->setCity('Musterstadt');
$address->setState('Musterland');
$address->setCountry($country1);
$address->setAddressType($addressType);
$address->setBillingAddress(true);
$address->setPrimaryAddress(true);
$address->setDeliveryAddress(false);
$address->setPostboxCity('Dornbirn');
$address->setPostboxPostcode('6850');
$address->setPostboxNumber('4711');
$contactAddress = new ContactAddress();
$contactAddress->setAddress($address);
$contactAddress->setContact($contact);
$contactAddress->setMain(true);
$contact->addContactAddress($contactAddress);
$address->addContactAddress($contactAddress);
$note = new Note();
$note->setValue('Note');
$contact->addNote($note);
$this->setUpMediaEntities($contact);
$this->em->persist($contact);
$this->em->persist($title);
$this->em->persist($position);
$this->em->persist($account);
$this->em->persist($account1);
$this->em->persist($phoneType);
$this->em->persist($phone);
$this->em->persist($faxType);
$this->em->persist($fax);
$this->em->persist($emailType);
$this->em->persist($email);
$this->em->persist($country1);
$this->em->persist($country2);
$this->em->persist($addressType);
$this->em->persist($contactAddress);
$this->em->persist($address);
$this->em->persist($note);
$this->em->flush();
}