src/ProductBundle/Entity/ProductDetails.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\ProductBundle\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Gedmo\Mapping\Annotation as Gedmo;
  7. /**
  8. * @Gedmo\Loggable
  9. * @ORM\Table(name="product_details")
  10. * @ORM\Entity()
  11. */
  12. class ProductDetails
  13. {
  14. /**
  15. * @ORM\Column(name="id", type="integer")
  16. * @ORM\Id
  17. * @ORM\GeneratedValue(strategy="AUTO")
  18. */
  19. private ?int $id = null;
  20. /**
  21. * @ORM\OneToOne(targetEntity="\App\ProductBundle\Entity\Product", inversedBy="details")
  22. */
  23. private ?Product $product = null;
  24. /**
  25. * Augmented reality URl
  26. * @ORM\Column(name="augmented_reality_url", type="text", nullable=true)
  27. */
  28. private ?string $augmentedRealityUrl = null;
  29. /**
  30. * @ORM\ManyToMany(targetEntity="Product")
  31. * @ORM\JoinTable(name="product_has_related_product",
  32. * joinColumns={@ORM\JoinColumn(name="product_id", referencedColumnName="id")},
  33. * inverseJoinColumns={@ORM\JoinColumn(name="related_product_id", referencedColumnName="id")}
  34. * )
  35. */
  36. private Collection $relatedProducts;
  37. public function __construct()
  38. {
  39. $this->relatedProducts = new ArrayCollection();
  40. }
  41. public function __clone()
  42. {
  43. if ($this->id) {
  44. $this->id = null;
  45. }
  46. }
  47. public function getId(): ?int
  48. {
  49. return $this->id;
  50. }
  51. public function getProduct(): ?Product
  52. {
  53. return $this->product;
  54. }
  55. public function setProduct(?Product $product): self
  56. {
  57. $this->product = $product;
  58. return $this;
  59. }
  60. /**
  61. * @return Collection<int, Product>
  62. */
  63. public function getRelatedProducts(): Collection
  64. {
  65. return $this->relatedProducts;
  66. }
  67. public function addRelatedProduct(Product $relatedProduct): self
  68. {
  69. if (!$this->relatedProducts->contains($relatedProduct)) {
  70. $this->relatedProducts->add($relatedProduct);
  71. }
  72. return $this;
  73. }
  74. public function removeRelatedProduct(Product $relatedProduct): self
  75. {
  76. $this->relatedProducts->removeElement($relatedProduct);
  77. return $this;
  78. }
  79. public function getAugmentedRealityUrl(): ?string
  80. {
  81. return $this->augmentedRealityUrl;
  82. }
  83. public function setAugmentedRealityUrl(?string $augmentedRealityUrl): self
  84. {
  85. $this->augmentedRealityUrl = $augmentedRealityUrl;
  86. return $this;
  87. }
  88. }