src/Entity/System/ProductCatalog.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Entity\System;
  3. use Doctrine\ORM\Mapping as ORM;
  4. /**
  5. * CatalogProduct
  6. *
  7. * @ORM\Table(name="product_catalog",
  8. * indexes={
  9. *
  10. * @ORM\Index(name="catalog_id", columns={"catalog_id"}),
  11. * @ORM\Index(name="product_id", columns={"product_id"}),
  12. * @ORM\Index(name="date_add", columns={"date_add"})
  13. * }
  14. * ,uniqueConstraints={@ORM\UniqueConstraint(name="catalog_product_idx", columns={"catalog_id", "product_id"})}
  15. * )
  16. *
  17. * @ORM\Entity(repositoryClass="App\Repository\System\ProductCatalogRepository")
  18. */
  19. class ProductCatalog
  20. {
  21. /**
  22. * @var int
  23. *
  24. * @ORM\Id
  25. *
  26. * @ORM\GeneratedValue(strategy="AUTO")
  27. *
  28. * @ORM\Column(type="integer")
  29. */
  30. private $id;
  31. /**
  32. * @var Catalog
  33. *
  34. * @ORM\ManyToOne(targetEntity="App\Entity\System\Catalog", inversedBy="productCatalogs")
  35. *
  36. * @ORM\JoinColumn(nullable=false, name="catalog_id", referencedColumnName="id")
  37. */
  38. private $catalog;
  39. /**
  40. * @var Product
  41. *
  42. * @ORM\ManyToOne(targetEntity="App\Entity\System\Product" , inversedBy="productCatalogs")
  43. *
  44. * @ORM\JoinColumn(nullable=false, name="product_id", referencedColumnName="id_product")
  45. */
  46. private $product;
  47. /**
  48. * @var \DateTime
  49. *
  50. * @ORM\Column(type="datetime")
  51. */
  52. private $dateAdd;
  53. public function __construct()
  54. {
  55. $this->dateAdd = new \DateTime();
  56. }
  57. /**
  58. * @return int
  59. */
  60. public function getId(): int
  61. {
  62. return $this->id;
  63. }
  64. /**
  65. * @param int $id
  66. *
  67. * @return ProductCatalog
  68. */
  69. public function setId(int $id): self
  70. {
  71. $this->id = $id;
  72. return $this;
  73. }
  74. /**
  75. * @return Catalog
  76. */
  77. public function getCatalog(): Catalog
  78. {
  79. return $this->catalog;
  80. }
  81. /**
  82. * @param Catalog $catalog
  83. *
  84. * @return ProductCatalog
  85. */
  86. public function setCatalog(Catalog $catalog): self
  87. {
  88. $this->catalog = $catalog;
  89. return $this;
  90. }
  91. public function getProduct(): Product
  92. {
  93. return $this->product;
  94. }
  95. /**
  96. * @param Product $product
  97. *
  98. * @return ProductCatalog
  99. */
  100. public function setProduct(Product $product): self
  101. {
  102. $this->product = $product;
  103. return $this;
  104. }
  105. /**
  106. * @return \DateTime
  107. */
  108. public function getDateAdd(): \DateTime
  109. {
  110. return $this->dateAdd;
  111. }
  112. /**
  113. * @param \DateTime $dateAdd
  114. *
  115. * @return ProductCatalog
  116. */
  117. public function setDateAdd(\DateTime $dateAdd): self
  118. {
  119. $this->dateAdd = $dateAdd;
  120. return $this;
  121. }
  122. }