2016-02-26 12:59:08 +00:00
|
|
|
<?php
|
|
|
|
|
2018-11-26 19:00:01 +00:00
|
|
|
namespace Wallabag\AnnotationBundle\DataFixtures;
|
2016-02-26 12:59:08 +00:00
|
|
|
|
2018-11-26 19:00:01 +00:00
|
|
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
|
|
|
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
|
2016-02-26 12:59:08 +00:00
|
|
|
use Doctrine\Common\Persistence\ObjectManager;
|
|
|
|
use Wallabag\AnnotationBundle\Entity\Annotation;
|
2018-11-26 19:00:01 +00:00
|
|
|
use Wallabag\CoreBundle\DataFixtures\EntryFixtures;
|
|
|
|
use Wallabag\UserBundle\DataFixtures\UserFixtures;
|
2016-02-26 12:59:08 +00:00
|
|
|
|
2018-11-26 19:00:01 +00:00
|
|
|
class AnnotationFixtures extends Fixture implements DependentFixtureInterface
|
2016-02-26 12:59:08 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function load(ObjectManager $manager)
|
|
|
|
{
|
|
|
|
$annotation1 = new Annotation($this->getReference('admin-user'));
|
|
|
|
$annotation1->setEntry($this->getReference('entry1'));
|
|
|
|
$annotation1->setText('This is my annotation /o/');
|
|
|
|
$annotation1->setQuote('content');
|
|
|
|
|
|
|
|
$manager->persist($annotation1);
|
|
|
|
|
|
|
|
$this->addReference('annotation1', $annotation1);
|
|
|
|
|
|
|
|
$annotation2 = new Annotation($this->getReference('admin-user'));
|
|
|
|
$annotation2->setEntry($this->getReference('entry2'));
|
|
|
|
$annotation2->setText('This is my 2nd annotation /o/');
|
|
|
|
$annotation2->setQuote('content');
|
|
|
|
|
|
|
|
$manager->persist($annotation2);
|
|
|
|
|
|
|
|
$this->addReference('annotation2', $annotation2);
|
|
|
|
|
|
|
|
$manager->flush();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
2018-11-26 19:00:01 +00:00
|
|
|
public function getDependencies()
|
2016-02-26 12:59:08 +00:00
|
|
|
{
|
2018-11-26 19:00:01 +00:00
|
|
|
return [
|
|
|
|
EntryFixtures::class,
|
|
|
|
UserFixtures::class,
|
|
|
|
];
|
2016-02-26 12:59:08 +00:00
|
|
|
}
|
|
|
|
}
|