Skip to content

Instantly share code, notes, and snippets.

@vojtabiberle
Created February 8, 2018 18:29
Show Gist options
  • Save vojtabiberle/ec9df148635a043efff4746f4f1708d9 to your computer and use it in GitHub Desktop.
Save vojtabiberle/ec9df148635a043efff4746f4f1708d9 to your computer and use it in GitHub Desktop.
Fixtures issue
<?php
namespace Eshop\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="Eshop\Repository\ProductTagRepository")
* @ORM\Table(name="product_tag")
**/
class ProductTag
{
/**
* @var int
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue
**/
protected $id;
/**
* @var Tag $tag
* @ORM\ManyToOne(targetEntity="Tag", cascade={"persist"})
* @ORM\JoinColumn(name="tag_id", referencedColumnName="id", nullable=false)
*/
protected $tag;
/**
* @var Product $product
* @ORM\ManyToOne(targetEntity="Product", cascade={"persist"})
* @ORM\JoinColumn(name="product_id", referencedColumnName="id", nullable=false)
*/
protected $product;
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
/**
* @param int $id
*/
public function setId(int $id)
{
$this->id = $id;
}
/**
* @return Tag
*/
public function getTag(): Tag
{
return $this->tag;
}
/**
* @param Tag $tag
*/
public function setTag(Tag $tag)
{
$this->tag = $tag;
}
/**
* @return Product
*/
public function getProduct(): Product
{
return $this->product;
}
/**
* @param Product $product
*/
public function setProduct(Product $product)
{
$this->product = $product;
}
}
Eshop\Entity\ProductTag:
ProductTag-1:
id: 12501
tag: '@Tag-1'
product: '@Product-2'
ProductTag-2:
id: 12502
tag: '@Tag-2'
product: '@Product-2'
ProductTag-3:
id: 13498
tag: '@Tag-3'
product: '@Product-2'
ProductTag-4:
id: 12461
tag: '@Tag-1'
product: '@Product-5'
ProductTag-5:
id: 12462
tag: '@Tag-2'
product: '@Product-5'
ProductTag-6:
id: 13477
tag: '@Tag-3'
product: '@Product-5'
ProductTag-7:
id: 12370
tag: '@Tag-1'
product: '@Product-6'
ProductTag-8:
id: 12371
tag: '@Tag-2'
product: '@Product-6'
ProductTag-9:
id: 13431
tag: '@Tag-3'
product: '@Product-6'
ProductTag-10:
id: 16526
tag: '@Tag-4'
product: '@Product-7'
ProductTag-11:
id: 17229
tag: '@Tag-5'
product: '@Product-9'
ProductTag-12:
id: 17230
tag: '@Tag-4'
product: '@Product-9'
ProductTag-13:
id: 12491
tag: '@Tag-1'
product: '@Product-10'
ProductTag-14:
id: 12492
tag: '@Tag-2'
product: '@Product-10'
ProductTag-15:
id: 13493
tag: '@Tag-3'
product: '@Product-10'
ProductTag-16:
id: 12505
tag: '@Tag-1'
product: '@Product-11'
ProductTag-17:
id: 12506
tag: '@Tag-2'
product: '@Product-11'
ProductTag-18:
id: 13500
tag: '@Tag-3'
product: '@Product-11'
ProductTag-19:
id: 8635
tag: '@Tag-1'
product: '@Product-12'
ProductTag-20:
id: 8636
tag: '@Tag-2'
product: '@Product-12'
ProductTag-21:
id: 8637
tag: '@Tag-3'
product: '@Product-12'
ProductTag-22:
id: 8638
tag: '@Tag-6'
product: '@Product-12'
ProductTag-23:
id: 18439
tag: '@Tag-7'
product: '@Product-12'
ProductTag-24:
id: 12729
tag: '@Tag-1'
product: '@Product-13'
ProductTag-25:
id: 12730
tag: '@Tag-2'
product: '@Product-13'
ProductTag-26:
id: 13615
tag: '@Tag-3'
product: '@Product-13'
ProductTag-27:
id: 4600
tag: '@Tag-7'
product: '@Product-15'
ProductTag-28:
id: 8655
tag: '@Tag-1'
product: '@Product-15'
ProductTag-29:
id: 8656
tag: '@Tag-2'
product: '@Product-15'
ProductTag-30:
id: 8657
tag: '@Tag-3'
product: '@Product-15'
ProductTag-31:
id: 8658
tag: '@Tag-6'
product: '@Product-15'
ProductTag-32:
id: 11691
tag: '@Tag-1'
product: '@Product-16'
ProductTag-33:
id: 11692
tag: '@Tag-2'
product: '@Product-16'
ProductTag-34:
id: 11693
tag: '@Tag-3'
product: '@Product-16'
ProductTag-35:
id: 11694
tag: '@Tag-6'
product: '@Product-16'
ProductTag-36:
id: 19167
tag: '@Tag-8'
product: '@Product-16'
<?php
namespace Eshop\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="Eshop\Repository\TagRepository")
* @ORM\Table(name="tag")
**/
class Tag
{
/**
* @var int
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue
**/
private $id;
/**
* @var string $name
* @ORM\Column(name="name", type="string", nullable=false)
*/
private $name;
/**
* @var string $description
* @ORM\Column(name="description", type="string", nullable=false)
*/
private $description;
/**
* @var string $color
* @ORM\Column(name="color", type="string", nullable=false)
*/
private $color;
/**
* @var ProductTag[]|Collection $productTags
* @ORM\OneToMany(targetEntity="ProductTag", mappedBy="tag", fetch="EXTRA_LAZY")
*/
private $productTags;
/**
* @var CategoryTagVisibility[]|Collection $categoryTagsVisibility
* @ORM\OneToMany(targetEntity="CategoryTagVisibility", mappedBy="tag", fetch="EXTRA_LAZY")
*/
private $categoryTagsVisibility;
/**
* @var CategoryMetaTag[]|Collection $categoryMetaTags
* @ORM\OneToMany(targetEntity="CategoryMetaTag", mappedBy="tag", fetch="EXTRA_LAZY")
*/
private $categoryMetaTags;
public function __construct()
{
$this->productTags = new ArrayCollection();
$this->categoryTagsVisibility = new ArrayCollection();
$this->categoryMetaTags = new ArrayCollection();
}
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
/**
* @param int $id
*/
public function setId(int $id)
{
$this->id = $id;
}
/**
* @return string
*/
public function getName(): string
{
return $this->name;
}
/**
* @param string $name
*/
public function setName(string $name)
{
$this->name = $name;
}
/**
* @return string
*/
public function getDescription(): string
{
return $this->description;
}
/**
* @param string $description
*/
public function setDescription(string $description)
{
$this->description = $description;
}
/**
* @return string
*/
public function getColor(): string
{
return $this->color;
}
/**
* @param string $color
*/
public function setColor(string $color)
{
$this->color = $color;
}
}
Eshop\Entity\Tag:
Tag-1:
id: 4
name: 'VO Franšízy'
description: 'Definuje sortiment pro Sklizeno Franšízy'
color: '#c2d100'
Tag-2:
id: 5
name: 'VO Sklizeno'
description: 'Defunuje sortiment pro Velkoobchod Sklizena'
color: '#009fb5'
Tag-3:
id: 6
name: 'NG Franšízy'
description: 'Definuje sortiment pro NG Franšízy'
color: '#725096'
Tag-4:
id: 7
name: 'NG Partneři'
description: 'Definuje srtiment pro NG Partnery'
color: '#fae64e'
Tag-5:
id: 8
name: 'Externí velkoobchod'
description: ''
color: '#d1d6db'
Tag-6:
id: 9
name: 'Kmenové prodejny'
description: ''
color: '#d01548'
Tag-7:
id: 10
name: 'Vlastní výroba Praha'
description: 'Štítek je určen pro vlastní výrobu v Praze'
color: '#fcbebe'
Tag-8:
id: 11
name: 'Vlastní výroba Brno'
description: 'Štítek je určen pro vlastní výrobu v Brno'
color: '#b1a9e4'
Tag-9:
id: 12
name: Starbucks
description: Starbucks
color: '#00a704'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment