]>
Commit | Line | Data |
---|---|---|
f38e03dc TC |
1 | <?php |
2 | ||
3 | namespace Wallabag\CoreBundle\DataFixtures\ORM; | |
4 | ||
5 | use Doctrine\Common\DataFixtures\AbstractFixture; | |
6 | use Doctrine\Common\DataFixtures\OrderedFixtureInterface; | |
7 | use Doctrine\Common\Persistence\ObjectManager; | |
8 | use Wallabag\CommentBundle\Entity\Comment; | |
9 | ||
10 | class LoadCommentData extends AbstractFixture implements OrderedFixtureInterface | |
11 | { | |
12 | /** | |
13 | * {@inheritdoc} | |
14 | */ | |
15 | public function load(ObjectManager $manager) | |
16 | { | |
17 | $comment1 = new Comment($this->getReference('admin-user')); | |
18 | $comment1->setEntry($this->getReference('entry1')); | |
19 | $comment1->setText('This is my comment /o/'); | |
20 | $comment1->setQuote('content'); | |
21 | ||
22 | $manager->persist($comment1); | |
23 | ||
24 | $this->addReference('comment1', $comment1); | |
25 | ||
26 | $comment2 = new Comment($this->getReference('admin-user')); | |
27 | $comment2->setEntry($this->getReference('entry2')); | |
28 | $comment2->setText('This is my 2nd comment /o/'); | |
29 | $comment2->setQuote('content'); | |
30 | ||
31 | $manager->persist($comment2); | |
32 | ||
33 | $this->addReference('comment2', $comment2); | |
34 | ||
35 | $manager->flush(); | |
36 | } | |
37 | ||
38 | /** | |
39 | * {@inheritdoc} | |
40 | */ | |
41 | public function getOrder() | |
42 | { | |
43 | return 35; | |
44 | } | |
45 | } |