aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CommentBundle/DataFixtures/ORM/LoadCommentData.php
blob: 717f48638c9d6b3e1eb2e59982a3525ef8f5482c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php

namespace Wallabag\CoreBundle\DataFixtures\ORM;

use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Wallabag\CommentBundle\Entity\Comment;

class LoadCommentData extends AbstractFixture implements OrderedFixtureInterface
{
    /**
     * {@inheritdoc}
     */
    public function load(ObjectManager $manager)
    {
        $comment1 = new Comment($this->getReference('admin-user'));
        $comment1->setEntry($this->getReference('entry1'));
        $comment1->setText('This is my comment /o/');
        $comment1->setQuote('content');

        $manager->persist($comment1);

        $this->addReference('comment1', $comment1);

        $comment2 = new Comment($this->getReference('admin-user'));
        $comment2->setEntry($this->getReference('entry2'));
        $comment2->setText('This is my 2nd comment /o/');
        $comment2->setQuote('content');

        $manager->persist($comment2);

        $this->addReference('comment2', $comment2);

        $manager->flush();
    }

    /**
     * {@inheritdoc}
     */
    public function getOrder()
    {
        return 35;
    }
}