/**
  * {@inheritdoc}
  */
 protected function loadEntities(ObjectManager $manager)
 {
     $addressTypeRepository = $manager->getRepository('OroAddressBundle:AddressType');
     $translationLocales = $this->getTranslationLocales();
     $addressTypes = $this->getAddressTypes();
     foreach ($translationLocales as $locale) {
         foreach ($addressTypes as $addressName) {
             // get address type entity
             /** @var AddressType $addressType */
             $addressType = $addressTypeRepository->findOneBy(array('name' => $addressName));
             if (!$addressType) {
                 $addressType = new AddressType($addressName);
             }
             // set locale and label
             $addressTypeLabel = $this->translate($addressName, static::ADDRESS_TYPE_PREFIX, $locale);
             $addressType->setLocale($locale)->setLabel($addressTypeLabel);
             // save
             $manager->persist($addressType);
         }
     }
     $manager->flush();
 }
Beispiel #2
0
 public function testLocale()
 {
     $this->assertNull($this->type->getLocale());
     $this->type->setLocale('en');
     $this->assertEquals('en', $this->type->getLocale());
 }