public function load(ObjectManager $manager) { $organization = current($this->organizationRepository->getEnabled()); for ($i = 1; $i <= 10; $i++) { $tag = new Tag('tag ' . $i); $tag->setOrganization($organization); $manager->persist($tag); } $manager->flush(); }
/** * @param $tagsNames * @return Tag[] */ protected function createTags($tagsNames) { $tags = array(); foreach ($tagsNames as $tagName) { $tag = new Tag($tagName); $tag->setOrganization($this->organization); $tags[] = $tag; } return $tags; }