Created
December 26, 2014 09:24
-
-
Save morontt/1f6b98af5b92e5e73256 to your computer and use it in GitHub Desktop.
tags fixtures
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace XtrCommunity\QuBundle\DataFixtures\ORM; | |
| use Doctrine\Common\DataFixtures\AbstractFixture; | |
| use Doctrine\Common\DataFixtures\OrderedFixtureInterface; | |
| use Doctrine\Common\Persistence\ObjectManager; | |
| use XtrCommunity\QuBundle\Entity\Tag; | |
| class LoadTagData extends AbstractFixture implements OrderedFixtureInterface | |
| { | |
| /** | |
| * {@inheritDoc} | |
| */ | |
| public function load(ObjectManager $manager) | |
| { | |
| $tagOne = new Tag(); | |
| $tagOne->setName('sleep'); | |
| $manager->persist($tagOne); | |
| $tagTwo = new Tag(); | |
| $tagTwo->setName('Mac'); | |
| $manager->persist($tagTwo); | |
| $tagThree = new Tag(); | |
| $tagThree->setName('security'); | |
| $manager->persist($tagThree); | |
| $tagFour = new Tag(); | |
| $tagFour->setName('Thunderbolt'); | |
| $manager->persist($tagFour); | |
| $tagFive = new Tag(); | |
| $tagFive->setName('Drive Icons'); | |
| $manager->persist($tagFive); | |
| $manager->flush(); | |
| $this->addReference('tag-one', $tagOne); | |
| $this->addReference('tag-two', $tagTwo); | |
| $this->addReference('tag-three', $tagThree); | |
| $this->addReference('tag-four', $tagFour); | |
| $this->addReference('tag-five', $tagFive); | |
| } | |
| public function getOrder() | |
| { | |
| return 2; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment