setCode() public method

Set code.
public setCode ( string $code ) : Country
$code string
return Country
Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function load(ObjectManager $manager)
 {
     // force id = 1
     $metadata = $manager->getClassMetaData(get_class(new Country()));
     $metadata->setIdGeneratorType(\Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_NONE);
     $i = 1;
     $file = dirname(__FILE__) . '/../countries.xml';
     $doc = new \DOMDocument();
     $doc->load($file);
     $xpath = new \DOMXpath($doc);
     $elements = $xpath->query('/Countries/Country');
     if (!is_null($elements)) {
         /** @var $element DOMNode */
         foreach ($elements as $element) {
             $country = new Country();
             $country->setId($i);
             $children = $element->childNodes;
             /** @var $child DOMNode */
             foreach ($children as $child) {
                 if (isset($child->nodeName)) {
                     if ($child->nodeName == 'Name') {
                         $country->setName($child->nodeValue);
                     }
                     if ($child->nodeName == 'Code') {
                         $country->setCode($child->nodeValue);
                     }
                 }
             }
             $manager->persist($country);
             ++$i;
         }
     }
     $manager->flush();
 }
Exemplo n.º 2
0
 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();
 }
Exemplo n.º 3
0
 private function initOrm()
 {
     $account = new Account();
     $account->setName('Company');
     $account->setPlaceOfJurisdiction('Feldkirch');
     $parentAccount = new Account();
     $parentAccount->setName('Parent');
     $parentAccount->setPlaceOfJurisdiction('Feldkirch');
     $childAccount = new Account();
     $childAccount->setName('Child');
     $childAccount->setPlaceOfJurisdiction('Feldkirch');
     $childAccount->setParent($parentAccount);
     $this->account = $account;
     $this->childAccount = $childAccount;
     $this->parentAccount = $parentAccount;
     $urlType = new UrlType();
     $urlType->setName('Private');
     $this->urlType = $urlType;
     $url = new Url();
     $url->setUrl('http://www.company.example');
     $this->url = $url;
     $url->setUrlType($urlType);
     $account->addUrl($url);
     $this->emailType = new EmailType();
     $this->emailType->setName('Private');
     $this->email = new Email();
     $this->email->setEmail('*****@*****.**');
     $this->email->setEmailType($this->emailType);
     $account->addEmail($this->email);
     $phoneType = new PhoneType();
     $phoneType->setName('Private');
     $this->phoneType = $phoneType;
     $phone = new Phone();
     $phone->setPhone('123456789');
     $phone->setPhoneType($phoneType);
     $account->addPhone($phone);
     $faxType = new FaxType();
     $faxType->setName('Private');
     $this->faxType = $faxType;
     $fax = new Fax();
     $fax->setFax('123654789');
     $fax->setFaxType($faxType);
     $account->addFax($fax);
     $country = new Country();
     $country->setName('Musterland');
     $country->setCode('ML');
     $this->country = $country;
     $addressType = new AddressType();
     $addressType->setName('Private');
     $this->addressType = $addressType;
     $address = new Address();
     $address->setStreet('Musterstraße');
     $address->setNumber('1');
     $address->setZip('0000');
     $address->setCity('Musterstadt');
     $address->setState('Musterland');
     $address->setCountry($country);
     $address->setAddition('');
     $address->setAddressType($addressType);
     $address->setBillingAddress(true);
     $address->setPrimaryAddress(true);
     $address->setDeliveryAddress(false);
     $address->setPostboxCity('Dornbirn');
     $address->setPostboxPostcode('6850');
     $address->setPostboxNumber('4711');
     $address->setNote('note');
     $this->address = $address;
     $accountAddress = new AccountAddress();
     $accountAddress->setAddress($address);
     $accountAddress->setAccount($account);
     $accountAddress->setMain(true);
     $account->addAccountAddress($accountAddress);
     $address->addAccountAddress($accountAddress);
     $contact = new Contact();
     $contact->setFirstName('Vorname');
     $contact->setLastName('Nachname');
     $contact->setMiddleName('Mittelname');
     $contact->setFormOfAddress(0);
     $accountContact = new AccountContact();
     $accountContact->setContact($contact);
     $accountContact->setAccount($account);
     $accountContact->setMain(true);
     $account->addAccountContact($accountContact);
     $note = new Note();
     $note->setValue('Note');
     $account->addNote($note);
     $this->initLogo();
     $account->setLogo($this->logo);
     $this->em->persist($account);
     $this->em->persist($childAccount);
     $this->em->persist($parentAccount);
     $this->em->persist($urlType);
     $this->em->persist($url);
     $this->em->persist($this->emailType);
     $this->em->persist($accountContact);
     $this->em->persist($this->email);
     $this->em->persist($phoneType);
     $this->em->persist($phone);
     $this->em->persist($country);
     $this->em->persist($addressType);
     $this->em->persist($address);
     $this->em->persist($accountAddress);
     $this->em->persist($note);
     $this->em->persist($faxType);
     $this->em->persist($fax);
     $this->em->persist($contact);
     $this->em->flush();
 }
Exemplo n.º 4
0
 /**
  * Setup test data.
  */
 protected function setUpTestData()
 {
     // Account
     $this->account = new Account();
     $this->account->setName('Company');
     $this->account->setType(Account::TYPE_BASIC);
     $this->account->setUid('uid-123');
     $this->account->setMainEmail('*****@*****.**');
     $this->account2 = clone $this->account;
     // Country
     $country = new Country();
     $country->setName('Country');
     $country->setCode('co');
     // Address type
     $addressType = new AddressType();
     $addressType->setName('Business');
     // Address
     $this->address = new Address();
     $this->address->setStreet('Sample-Street');
     $this->address->setNumber('12');
     $this->address->setAddition('Entrance 2');
     $this->address->setCity('Sample-City');
     $this->address->setState('State');
     $this->address->setZip('12345');
     $this->address->setCountry($country);
     $this->address->setPostboxNumber('postboxNumber');
     $this->address->setPostboxPostcode('postboxPostcode');
     $this->address->setPostboxCity('postboxCity');
     $this->address->setAddressType($addressType);
     // Address
     $this->address2 = new Address();
     $this->address2->setStreet('Street');
     $this->address2->setNumber('2');
     $this->address2->setCity('Utopia');
     $this->address2->setZip('1');
     $this->address2->setCountry($country);
     $this->address2->setAddressType($addressType);
     // Add address to entities.
     $accountAddress = new AccountAddress();
     $accountAddress->setAccount($this->account);
     $accountAddress->setAddress($this->address);
     $accountAddress->setMain(true);
     $this->account->addAccountAddress($accountAddress);
     // Phone
     $phoneType = new PhoneType();
     $phoneType->setName('Business');
     $this->phone = new Phone();
     $this->phone->setPhone('+43 123 / 456 789');
     $this->phone->setPhoneType($phoneType);
     // Contact Title
     $title = new ContactTitle();
     $title->setTitle('Dr');
     // Contact
     $this->contact = $this->contactRepository->createNew();
     $this->contact->setFirstName('John');
     $this->contact->setLastName('Doe');
     $this->contact->setTitle($title);
     $this->contact->setMainEmail('*****@*****.**');
     // Second Contact
     $this->contact2 = $this->contactRepository->createNew();
     $this->contact2->setFirstName('Johanna');
     $this->contact2->setLastName('Dole');
     $this->contact2->setMainEmail('*****@*****.**');
     $contact = $this->contactRepository->createNew();
     $contact->setFirstName('Max');
     $contact->setLastName('Mustermann');
     $this->em->persist($contact);
     $this->accountContact = $this->createAccountContact($this->account, $this->contact, true);
     $this->accountContact2 = $this->createAccountContact($this->account, $this->contact2, true);
     $user = new User();
     $user->setUsername('test');
     $user->setPassword('test');
     $user->setSalt('');
     $user->setLocale('en');
     $user->setContact($this->contact);
     $this->user = $user;
     $this->orderStatus = $this->em->getRepository(self::$orderStatusEntityName)->find(OrderStatus::STATUS_CREATED);
     // Order address
     $this->orderAddressDelivery = new OrderAddress();
     $this->orderAddressDelivery->setFirstName($this->contact->getFirstName());
     $this->orderAddressDelivery->setLastName($this->contact->getLastName());
     $this->orderAddressDelivery->setTitle($title->getTitle());
     $this->orderAddressDelivery->setStreet($this->address->getStreet());
     $this->orderAddressDelivery->setNumber($this->address->getNumber());
     $this->orderAddressDelivery->setAddition($this->address->getAddition());
     $this->orderAddressDelivery->setCity($this->address->getCity());
     $this->orderAddressDelivery->setZip($this->address->getZip());
     $this->orderAddressDelivery->setState($this->address->getState());
     $this->orderAddressDelivery->setCountry($this->address->getCountry()->getName());
     $this->orderAddressDelivery->setPostboxNumber($this->address->getPostboxNumber());
     $this->orderAddressDelivery->setPostboxPostcode($this->address->getPostboxPostcode());
     $this->orderAddressDelivery->setPostboxCity($this->address->getPostboxCity());
     $this->orderAddressDelivery->setAccountName($this->account->getName());
     $this->orderAddressDelivery->setUid($this->account->getUid());
     $this->orderAddressDelivery->setPhone($this->phone->getPhone());
     $this->orderAddressDelivery->setPhoneMobile('+43 123 / 456');
     $this->orderAddressDelivery->setContactAddress($this->address);
     // Clone address for invoice.
     $this->orderAddressInvoice = clone $this->orderAddressDelivery;
     $this->termsOfDelivery = new TermsOfDelivery();
     $this->termsOfDelivery->setTerms('10kg minimum');
     $this->termsOfPayment = new TermsOfPayment();
     $this->termsOfPayment->setTerms('10% off');
     // Order
     $this->order = $this->createNewTestOrder();
     $order2 = $this->createNewTestOrder();
     $order2->setNumber('12345');
     $order2->setDeliveryAddress(null);
     $order2->setInvoiceAddress(null);
     // Product order unit
     $orderUnit = new Unit();
     $orderUnit->setId(1);
     $orderUnitTranslation = new UnitTranslation();
     $orderUnitTranslation->setUnit($orderUnit);
     $orderUnitTranslation->setName('pc');
     $orderUnitTranslation->setLocale('en');
     $orderUnit->addTranslation($orderUnitTranslation);
     $this->em->persist($orderUnit);
     $this->em->persist($orderUnitTranslation);
     // Product type
     $productType = new Type();
     $productType->setTranslationKey('product-type');
     // Product status
     $productStatus = new Status();
     $productStatus->setId(Status::ACTIVE);
     $metadata = $this->em->getClassMetadata(Status::class);
     $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
     $productStatusTranslation = new StatusTranslation();
     $productStatusTranslation->setLocale($this->locale);
     $productStatusTranslation->setName('EnglishProductStatus-1');
     $productStatusTranslation->setStatus($productStatus);
     // Product
     $this->product = new $this->productEntity();
     $this->product->setNumber('ProductNumber-1');
     $this->product->setManufacturer('EnglishManufacturer-1');
     $this->product->setType($productType);
     $this->product->setStatus($productStatus);
     $this->product->setCreated(new DateTime());
     $this->product->setChanged(new DateTime());
     $this->product->setSupplier($this->account);
     $this->product->setOrderUnit($orderUnit);
     // Product translation
     $this->productTranslation = new ProductTranslation();
     $this->productTranslation->setProduct($this->product);
     $this->productTranslation->setLocale($this->locale);
     $this->productTranslation->setName('EnglishProductTranslationName-1');
     $this->productTranslation->setShortDescription('EnglishProductShortDescription-1');
     $this->productTranslation->setLongDescription('EnglishProductLongDescription-1');
     $this->product->addTranslation($this->productTranslation);
     // Product
     $this->product2 = clone $this->product;
     $this->product2->setSupplier($this->account);
     $translation2 = clone $this->productTranslation;
     $translation2->setProduct($this->product2);
     $this->product2->addTranslation($translation2);
     $this->em->persist($translation2);
     $this->currency = new Currency();
     $this->currency->setCode($this->defaultCurrencyCode);
     $this->currency->setNumber('1');
     $this->currency->setId('1');
     $this->currency->setName('Euro');
     $this->productPrice = new ProductPrice();
     $this->productPrice->setCurrency($this->currency);
     $this->productPrice->setMinimumQuantity(0);
     $this->productPrice->setPrice(14.5);
     $this->productPrice->setProduct($this->product);
     $this->product->addPrice($this->productPrice);
     $price2 = clone $this->productPrice;
     $price2->setProduct($this->product2);
     $price2->setPrice(15.5);
     $this->em->persist($price2);
     $this->product2->addPrice($price2);
     // Item
     $this->item = $this->createNewTestItem();
     $this->item2 = $this->createNewTestItem();
     $this->item2->setSupplier($this->account2);
     $orderTypeTranslationManual = new OrderTypeTranslation();
     $orderTypeTranslationManual->setLocale('en');
     $orderTypeTranslationManual->setName('order type translation manual');
     $orderTypeTranslationShop = new OrderTypeTranslation();
     $orderTypeTranslationShop->setLocale('en');
     $orderTypeTranslationShop->setName('order type translation shop');
     $orderTypeTranslationAnon = new OrderTypeTranslation();
     $orderTypeTranslationAnon->setLocale('en');
     $orderTypeTranslationAnon->setName('order type translation anon');
     $this->orderTypeManual = new OrderType();
     $metadata = $this->em->getClassMetadata(get_class($this->orderTypeManual));
     $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
     $this->orderTypeManual->setId(OrderType::MANUAL);
     $this->orderTypeManual->addTranslation($orderTypeTranslationManual);
     $orderTypeTranslationManual->setType($this->orderTypeManual);
     $this->orderTypeShop = new OrderType();
     $metadata = $this->em->getClassMetadata(get_class($this->orderTypeShop));
     $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
     $this->orderTypeShop->setId(OrderType::SHOP);
     $this->orderTypeShop->addTranslation($orderTypeTranslationShop);
     $orderTypeTranslationShop->setType($this->orderTypeShop);
     $this->orderTypeAnon = new OrderType();
     $metadata = $this->em->getClassMetadata(get_class($this->orderTypeAnon));
     $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
     $this->orderTypeAnon->setId(OrderType::ANONYMOUS);
     $this->orderTypeAnon->addTranslation($orderTypeTranslationAnon);
     $orderTypeTranslationAnon->setType($this->orderTypeAnon);
     $this->order->addItem($this->item);
     $this->order->addItem($this->item2);
     $this->order->setType($this->orderTypeManual);
     $order2->setType($this->orderTypeManual);
     $item = $this->createNewTestItem();
     $item2 = $this->createNewTestItem();
     $order2->addItem($item);
     $order2->addItem($item2);
     $this->addonPrice = new AddonPrice();
     $this->addonPrice->setPrice(123.56);
     $this->addonPrice->setCurrency($this->currency);
     $this->addon = new Addon();
     $this->addon->setProduct($this->product);
     $this->addon->setAddon($this->product2);
     $this->addonPrice->setAddon($this->addon);
     $this->addon->addAddonPrice($this->addonPrice);
     $this->em->persist($this->addon);
     $this->em->persist($this->addonPrice);
     $this->em->persist($item);
     $this->em->persist($item2);
     $this->em->persist($accountAddress);
     $this->em->persist($this->currency);
     $this->em->persist($this->productPrice);
     $this->em->persist($user);
     $this->em->persist($this->orderTypeManual);
     $this->em->persist($this->orderTypeShop);
     $this->em->persist($this->orderTypeAnon);
     $this->em->persist($orderTypeTranslationManual);
     $this->em->persist($orderTypeTranslationShop);
     $this->em->persist($orderTypeTranslationAnon);
     $this->em->persist($this->account);
     $this->em->persist($this->account2);
     $this->em->persist($title);
     $this->em->persist($country);
     $this->em->persist($this->termsOfPayment);
     $this->em->persist($this->termsOfDelivery);
     $this->em->persist($country);
     $this->em->persist($addressType);
     $this->em->persist($this->address);
     $this->em->persist($this->address2);
     $this->em->persist($phoneType);
     $this->em->persist($this->phone);
     $this->em->persist($this->contact);
     $this->em->persist($this->contact2);
     $this->em->persist($this->orderAddressDelivery);
     $this->em->persist($this->orderAddressInvoice);
     $this->em->persist($this->item);
     $this->em->persist($this->item2);
     $this->em->persist($this->product);
     $this->em->persist($this->product2);
     $this->em->persist($this->productTranslation);
     $this->em->persist($productType);
     $this->em->persist($productStatus);
     $this->em->persist($productStatusTranslation);
     $this->em->flush();
 }
Exemplo n.º 5
0
 private 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');
     $contact->setDisabled(0);
     $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');
     $this->account = $account;
     $account1 = new Account();
     $account1->setLft(0);
     $account1->setRgt(1);
     $account1->setDepth(0);
     $account1->setName('Musterfirma');
     $this->account1 = $account1;
     $phoneType = new PhoneType();
     $phoneType->setName('Private');
     $this->phoneType = $phoneType;
     $phone = new Phone();
     $phone->setPhone('123456789');
     $phone->setPhoneType($phoneType);
     $contact->addPhone($phone);
     $this->phone = $phone;
     $emailType = new EmailType();
     $emailType->setName('Private');
     $this->emailType = $emailType;
     $email = new Email();
     $email->setEmail('*****@*****.**');
     $email->setEmailType($emailType);
     $contact->addEmail($email);
     $this->email = $email;
     $faxType = new FaxType();
     $faxType->setName('Private');
     $this->faxType = $faxType;
     $fax = new Fax();
     $fax->setFax('123654789');
     $fax->setFaxType($faxType);
     $contact->addFax($fax);
     $this->fax = $fax;
     $country1 = new Country();
     $country1->setName('Musterland');
     $country1->setCode('ML');
     $this->country = $country1;
     $country2 = new Country();
     $country2->setName('United States');
     $country2->setCode('US');
     $this->country2 = $country2;
     $addressType = new AddressType();
     $addressType->setName('Private');
     $this->addressType = $addressType;
     $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');
     $address->setNote('Note');
     $this->address = $address;
     $contactAddress = new ContactAddress();
     $contactAddress->setAddress($address);
     $contactAddress->setContact($contact);
     $contactAddress->setMain(true);
     $this->contactAddress = $contactAddress;
     $contact->addContactAddress($contactAddress);
     $address->addContactAddress($contactAddress);
     $note = new Note();
     $note->setValue('Note');
     $this->note = $note;
     $contact->addNote($note);
     $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);
     /* First Category
        -------------------------------------*/
     $category = new Category();
     $category->setKey('first-category-key');
     $this->category = $category;
     // name for first category
     $categoryTrans = new CategoryTranslation();
     $categoryTrans->setLocale('en');
     $categoryTrans->setTranslation('First Category');
     $categoryTrans->setCategory($category);
     $category->addTranslation($categoryTrans);
     // meta for first category
     $categoryMeta = new CategoryMeta();
     $categoryMeta->setLocale('en');
     $categoryMeta->setKey('description');
     $categoryMeta->setValue('Description of Category');
     $categoryMeta->setCategory($category);
     $category->addMeta($categoryMeta);
     $this->em->persist($category);
     /* Second Category
        -------------------------------------*/
     $category2 = new Category();
     $category2->setKey('second-category-key');
     $this->category2 = $category2;
     // name for second category
     $categoryTrans2 = new CategoryTranslation();
     $categoryTrans2->setLocale('de');
     $categoryTrans2->setTranslation('Second Category');
     $categoryTrans2->setCategory($category2);
     $category2->addTranslation($categoryTrans2);
     // meta for second category
     $categoryMeta2 = new CategoryMeta();
     $categoryMeta2->setLocale('de');
     $categoryMeta2->setKey('description');
     $categoryMeta2->setValue('Description of second Category');
     $categoryMeta2->setCategory($category2);
     $category2->addMeta($categoryMeta2);
     $this->em->persist($category2);
     $this->em->flush();
     $this->contactTitle = $title;
     $this->contactPosition = $position;
 }