mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-27 03:21:01 +00:00
fixtures for tag
This commit is contained in:
parent
1bd12b6229
commit
6c87418ff0
2 changed files with 100 additions and 0 deletions
|
@ -6,6 +6,7 @@ use Doctrine\Common\DataFixtures\AbstractFixture;
|
|||
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||
use Doctrine\Common\Persistence\ObjectManager;
|
||||
use Wallabag\CoreBundle\Entity\Tag;
|
||||
use Wallabag\CoreBundle\Entity\TagsEntries;
|
||||
|
||||
class LoadTagData extends AbstractFixture implements OrderedFixtureInterface
|
||||
{
|
||||
|
@ -19,16 +20,34 @@ class LoadTagData extends AbstractFixture implements OrderedFixtureInterface
|
|||
|
||||
$manager->persist($tag1);
|
||||
|
||||
$this->addReference('tag1', $tag1);
|
||||
|
||||
$tagsEntries1 = new TagsEntries();
|
||||
$tagsEntries1->setEntryId($this->getReference('entry1'));
|
||||
$manager->persist($tagsEntries1);
|
||||
|
||||
$tag2 = new Tag();
|
||||
$tag2->setLabel('bar');
|
||||
|
||||
$manager->persist($tag2);
|
||||
|
||||
$this->addReference('tag2', $tag2);
|
||||
|
||||
$tagsEntries2 = new TagsEntries();
|
||||
$tagsEntries2->setEntryId($this->getReference('entry2'));
|
||||
$manager->persist($tagsEntries2);
|
||||
|
||||
$tag3 = new Tag();
|
||||
$tag3->setLabel('baz');
|
||||
|
||||
$manager->persist($tag3);
|
||||
|
||||
$this->addReference('tag3', $tag3);
|
||||
|
||||
$tagsEntries3 = new TagsEntries();
|
||||
$tagsEntries3->setEntryId($this->getReference('entry2'));
|
||||
$manager->persist($tagsEntries3);
|
||||
|
||||
$manager->flush();
|
||||
}
|
||||
|
||||
|
|
81
src/Wallabag/CoreBundle/Entity/TagsEntries.php
Normal file
81
src/Wallabag/CoreBundle/Entity/TagsEntries.php
Normal file
|
@ -0,0 +1,81 @@
|
|||
<?php
|
||||
|
||||
namespace Wallabag\CoreBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* TagsEntries
|
||||
*
|
||||
* @ORM\Table(name="tags_entries")
|
||||
*/
|
||||
class TagsEntries
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="Entry", inversedBy="tags_entries")
|
||||
* @ORM\JoinColumn(name="entry_id", referencedColumnName="id")
|
||||
*
|
||||
*/
|
||||
private $entryId;
|
||||
|
||||
/**
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="Tag", inversedBy="tags_entries")
|
||||
* @ORM\JoinColumn(name="tag_id", referencedColumnName="id")
|
||||
*
|
||||
*/
|
||||
private $tagId;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getEntryId()
|
||||
{
|
||||
return $this->entryId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $entryId
|
||||
*/
|
||||
public function setEntryId($entryId)
|
||||
{
|
||||
$this->entryId = $entryId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getTagId()
|
||||
{
|
||||
return $this->tagId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $tagId
|
||||
*/
|
||||
public function setTagId($tagId)
|
||||
{
|
||||
$this->tagId = $tagId;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue