public function testEntityRequiresNonEmptyName() { $entity = new Unit(); $entity->translate('en')->setName(''); $entity->mergeNewTranslations(); $errors = $this->validator->validate($entity); $this->assertEquals(1, count($errors)); }
/** * {@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(); }
/** * @return \WellCommerce\AppBundle\Entity\UnitInterface */ public function create() { $unit = new Unit(); $unit->setCreatedAt(new \DateTime()); return $unit; }