2016-02-26 12:59:08 +00:00
|
|
|
<?php
|
|
|
|
|
2024-02-19 00:30:12 +00:00
|
|
|
namespace Wallabag\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;
|
2020-06-15 06:25:59 +00:00
|
|
|
use Doctrine\Persistence\ObjectManager;
|
2024-02-19 00:30:12 +00:00
|
|
|
use Wallabag\Entity\Annotation;
|
|
|
|
use Wallabag\Entity\Entry;
|
|
|
|
use Wallabag\Entity\User;
|
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
|
|
|
{
|
|
|
|
public function load(ObjectManager $manager)
|
|
|
|
{
|
2023-08-05 16:25:03 +00:00
|
|
|
$annotation1 = new Annotation($this->getReference('admin-user', User::class));
|
|
|
|
$annotation1->setEntry($this->getReference('entry1', Entry::class));
|
2016-02-26 12:59:08 +00:00
|
|
|
$annotation1->setText('This is my annotation /o/');
|
|
|
|
$annotation1->setQuote('content');
|
|
|
|
|
|
|
|
$manager->persist($annotation1);
|
|
|
|
|
|
|
|
$this->addReference('annotation1', $annotation1);
|
|
|
|
|
2023-08-05 16:25:03 +00:00
|
|
|
$annotation2 = new Annotation($this->getReference('admin-user', User::class));
|
|
|
|
$annotation2->setEntry($this->getReference('entry2', Entry::class));
|
2016-02-26 12:59:08 +00:00
|
|
|
$annotation2->setText('This is my 2nd annotation /o/');
|
|
|
|
$annotation2->setQuote('content');
|
|
|
|
|
|
|
|
$manager->persist($annotation2);
|
|
|
|
|
|
|
|
$this->addReference('annotation2', $annotation2);
|
|
|
|
|
2023-08-05 16:25:03 +00:00
|
|
|
$annotation3 = new Annotation($this->getReference('bob-user', User::class));
|
|
|
|
$annotation3->setEntry($this->getReference('entry3', Entry::class));
|
2023-01-23 11:16:09 +00:00
|
|
|
$annotation3->setText('This is my first annotation !');
|
|
|
|
$annotation3->setQuote('content');
|
|
|
|
|
|
|
|
$manager->persist($annotation3);
|
|
|
|
|
|
|
|
$this->addReference('annotation3', $annotation3);
|
|
|
|
|
2016-02-26 12:59:08 +00:00
|
|
|
$manager->flush();
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|