public function load(ObjectManager $manager) { $manufacturer = new Manufacturer(); $manufacturer->setName('TEST'); $manager->persist($manufacturer); $manager->flush(); $this->addReference('manufacturer.first', $manufacturer); }
protected function createManufacturer($manufacturerName, $manufacturerData) { $manufacturer = new Manufacturer(); $manufacturer->setName($manufacturerName); if (array_key_exists('iclogos', $manufacturerData)) { foreach ($manufacturerData['iclogos'] as $icLogo) { $manufacturerIcLogo = new ManufacturerICLogo(); $file = $this->kernel->locateResource(self::MANUFACTURER_PATH . $icLogo); $this->uploadedFileService->replaceFromFilesystem($manufacturerIcLogo, new File($file)); $manufacturer->addIcLogo($manufacturerIcLogo); } } $this->entityManager->persist($manufacturer); }
protected function createManufacturer($manufacturerName, $manufacturerData) { $fileService = $this->get("partkeepr_uploadedfile_service"); $manufacturer = new Manufacturer(); $manufacturer->setName($manufacturerName); if (array_key_exists("iclogos", $manufacturerData)) { foreach ($manufacturerData["iclogos"] as $icLogo) { $manufacturerIcLogo = new ManufacturerICLogo(); $file = $this->get("kernel")->locateResource(self::MANUFACTURER_PATH . $icLogo); $fileService->replaceFromFilesystem($manufacturerIcLogo, new File($file)); $manufacturer->addIcLogo($manufacturerIcLogo); } } $this->get("doctrine.orm.default_entity_manager")->persist($manufacturer); }