Пример #1
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $unit = new Unit();
     $unit->translate('pl')->setName('szt');
     $unit->translate('en')->setName('pcs');
     $unit->translate('de')->setName('pcs');
     $unit->translate('fr')->setName('pcs');
     $unit->mergeNewTranslations();
     $manager->persist($unit);
     $manager->flush();
 }
Пример #2
0
 public function testEntityRequiresNonEmptyName()
 {
     $entity = new Unit();
     $entity->translate('en')->setName('');
     $entity->mergeNewTranslations();
     $errors = $this->validator->validate($entity);
     $this->assertEquals(1, count($errors));
 }
Пример #3
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     foreach (self::$samples as $name) {
         $unit = new Unit();
         $unit->translate('en')->setName($name);
         $unit->mergeNewTranslations();
         $manager->persist($unit);
         $this->setReference('unit_' . $name, $unit);
     }
     $manager->flush();
 }
Пример #4
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     if (!$this->isEnabled()) {
         return;
     }
     foreach (self::$samples as $name) {
         $unit = new Unit();
         $unit->translate($this->getDefaultLocale())->setName($name);
         $unit->mergeNewTranslations();
         $manager->persist($unit);
         $this->setReference('unit_' . $name, $unit);
     }
     $manager->flush();
 }