Exemplo n.º 1
0
 public function testEntityRequiresNonEmptyName()
 {
     $entity = new Unit();
     $entity->translate('en')->setName('');
     $entity->mergeNewTranslations();
     $errors = $this->validator->validate($entity);
     $this->assertEquals(1, count($errors));
 }
Exemplo n.º 2
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();
 }
Exemplo n.º 3
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();
 }
Exemplo n.º 4
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();
 }
Exemplo n.º 5
0
 /**
  * @return \WellCommerce\Bundle\UnitBundle\Entity\UnitInterface
  */
 public function create()
 {
     $unit = new Unit();
     $unit->setCreatedAt(new \DateTime());
     return $unit;
 }