src/Entity/Accessories.php line 15

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\AccessoriesRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\HttpFoundation\File\File;
  8. use Symfony\Component\Serializer\Annotation\Groups;
  9. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  10. #[ORM\Entity(repositoryClassAccessoriesRepository::class)]
  11. #[Vich\Uploadable]
  12. class Accessories
  13. {
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column(type"integer")]
  17.     #[Groups(["products"])]
  18.     private $id;
  19.     #[ORM\Column(type"string"length255nullabletrue)]
  20.     #[Groups(["products"])]
  21.     private $title;
  22.     #[ORM\Column(type"string"length2048nullabletrue)]
  23.     #[Groups(["products"])]
  24.     private $shortDescription;
  25.     #[ORM\Column(type"string"length2048nullabletrue)]
  26.     #[Groups(["products"])]
  27.     private $longDescription;
  28.     #[ORM\Column(type"string"length255nullabletrue)]
  29.     #[Groups(["products"])]
  30.     private $thumbnail;
  31.     #[Vich\UploadableField(mapping"product_images"fileNameProperty"thumbnail")]
  32.     private $thumbnailFile;
  33.     #[ORM\Column(type"boolean"nullabletrue)]
  34.     #[Groups(["products"])]
  35.     private $beta;
  36.     #[ORM\Column(type"string"length255nullabletrue)]
  37.     #[Groups(["products"])]
  38.     private $adBanner;
  39.     #[Vich\UploadableField(mapping"product_images"fileNameProperty"adBanner")]
  40.     private $adBannerFile;
  41.     #[ORM\Column(type"string"length2048nullabletrue)]
  42.     #[Groups(["products"])]
  43.     private $adBannerText;
  44.     #[ORM\ManyToOne(targetEntityAccessoriesMaterials::class)]
  45.     #[ORM\JoinColumn(name"default_material_id"referencedColumnName"id")]
  46.     private $defaultMaterial;
  47.     #[ORM\OneToMany(mappedBy"accessory_id"targetEntityAccessoriesMaterials::class, cascade: ["persist""remove"])]
  48.     #[Groups(["products"])]
  49.     private $accessoryMaterials;
  50.     #[ORM\Column(type"string"length255nullabletrue)]
  51.     #[Groups(["products"])]
  52.     private $modelName;
  53.     #[ORM\Column(type"boolean"nullabletrue)]
  54.     #[Groups(["products"])]
  55.     private $recommended;
  56.     #[ORM\Column(type"string"length2048nullabletrue)]
  57.     #[Groups(["products"])]
  58.     private $recommendedText;
  59.     #[ORM\ManyToMany(targetEntityPfosten::class, mappedBy"accessories")]
  60.     private $pfostens;
  61.     #[ORM\ManyToMany(targetEntityTerrasse::class, mappedBy"accessories")]
  62.     private $terrasses;
  63.     #[ORM\ManyToMany(targetEntityZaunelement::class, mappedBy"accessories")]
  64.     private $zaunelements;
  65.     #[ORM\Column(type"datetime"nullabletrue)]
  66.     #[Groups(["products"])]
  67.     private $updated_at;
  68.     #[ORM\ManyToOne(targetEntityAccessoriesMaterials::class, inversedBy"accessories")]
  69.     #[Groups(["products"])]
  70.     private $default_material_combination;
  71.     #[ORM\ManyToMany(targetEntityself::class)]
  72.     #[Groups(["products"])]
  73.     private Collection $accessories;
  74.     public function __construct()
  75.     {
  76.         $this->pfostens = new ArrayCollection();
  77.         $this->terrasses = new ArrayCollection();
  78.         $this->zaunelements = new ArrayCollection();
  79.         $this->accessoryMaterials = new ArrayCollection();
  80.         $this->accessories = new ArrayCollection();
  81.     }
  82.     public function __toString()
  83.     {
  84.        return $this->title;
  85.     }
  86.     public function getId(): ?int
  87.     {
  88.         return $this->id;
  89.     }
  90.     public function getTitle(): ?string
  91.     {
  92.         return $this->title;
  93.     }
  94.     public function setTitle(?string $title): self
  95.     {
  96.         $this->title $title;
  97.         return $this;
  98.     }
  99.     public function getShortDescription(): ?string
  100.     {
  101.         return $this->shortDescription;
  102.     }
  103.     public function setShortDescription(?string $shortDescription): self
  104.     {
  105.         $this->shortDescription $shortDescription;
  106.         return $this;
  107.     }
  108.     public function getLongDescription(): ?string
  109.     {
  110.         return $this->longDescription;
  111.     }
  112.     public function setLongDescription(?string $longDescription): self
  113.     {
  114.         $this->longDescription $longDescription;
  115.         return $this;
  116.     }
  117.     public function getThumbnail(): ?string
  118.     {
  119.         return $this->thumbnail;
  120.     }
  121.     public function setThumbnail(?string $thumbnail): self
  122.     {
  123.         $this->thumbnail $thumbnail;
  124.         return $this;
  125.     }
  126.     public function getBeta(): ?bool
  127.     {
  128.         return $this->beta;
  129.     }
  130.     public function setBeta(?bool $beta): self
  131.     {
  132.         $this->beta $beta;
  133.         return $this;
  134.     }
  135.     public function getAdBanner(): ?string
  136.     {
  137.         return $this->adBanner;
  138.     }
  139.     public function setAdBanner(?string $adBanner): self
  140.     {
  141.         $this->adBanner $adBanner;
  142.         return $this;
  143.     }
  144.     public function getAdBannerText(): ?string
  145.     {
  146.         return $this->adBannerText;
  147.     }
  148.     public function setAdBannerText(?string $adBannerText): self
  149.     {
  150.         $this->adBannerText $adBannerText;
  151.         return $this;
  152.     }
  153.     /**
  154.      * @param null|File $image
  155.      */
  156.     public function setThumbnailFile(File $image null)
  157.     {
  158.         $this->thumbnailFile $image;
  159.         // VERY IMPORTANT:
  160.         // It is required that at least one field changes if you are using Doctrine,
  161.         // otherwise the event listeners won't be called and the file is lost
  162.         if ($image) {
  163.             // if 'updatedAt' is not defined in your entity, use another property
  164.             $this->updated_at = new \DateTime('now');
  165.         }
  166.     }
  167.     /**
  168.      * @return null|File
  169.      */
  170.     public function getThumbnailFile(): ?File
  171.     {
  172.         return $this->thumbnailFile;
  173.     }
  174.     /**
  175.      * @param null|File $image
  176.      */
  177.     public function setAdBannerFile(File $image null)
  178.     {
  179.         $this->adBannerFile $image;
  180.         // VERY IMPORTANT:
  181.         // It is required that at least one field changes if you are using Doctrine,
  182.         // otherwise the event listeners won't be called and the file is lost
  183.         if ($image) {
  184.             // if 'updatedAt' is not defined in your entity, use another property
  185.             $this->updatedAt = new \DateTime('now');
  186.         }
  187.     }
  188.     /**
  189.      * @return null|File
  190.      */
  191.     public function getAdBannerFile(): ?File
  192.     {
  193.         return $this->adBannerFile;
  194.     }
  195.     public function getDefaultMaterial(): ?Material
  196.     {
  197.         return $this->defaultMaterial;
  198.     }
  199.     public function setDefaultMaterial(?Material $defaultMaterial): self
  200.     {
  201.         $this->defaultMaterial $defaultMaterial;
  202.         return $this;
  203.     }
  204.     public function getModelName(): ?string
  205.     {
  206.         return $this->modelName;
  207.     }
  208.     public function setModelName(?string $modelName): self
  209.     {
  210.         $this->modelName $modelName;
  211.         return $this;
  212.     }
  213.     public function getRecommended(): ?bool
  214.     {
  215.         return $this->recommended;
  216.     }
  217.     public function setRecommended(?bool $recommended): self
  218.     {
  219.         $this->recommended $recommended;
  220.         return $this;
  221.     }
  222.     public function getRecommendedText(): ?string
  223.     {
  224.         return $this->recommendedText;
  225.     }
  226.     public function setRecommendedText(?string $recommendedText): self
  227.     {
  228.         $this->recommendedText $recommendedText;
  229.         return $this;
  230.     }
  231.     /**
  232.      * @return Collection|Pfosten[]
  233.      */
  234.     public function getPfostens(): Collection|array
  235.     {
  236.         return $this->pfostens;
  237.     }
  238.     public function addPfosten(Pfosten $pfosten): self
  239.     {
  240.         if (!$this->pfostens->contains($pfosten)) {
  241.             $this->pfostens[] = $pfosten;
  242.             $pfosten->addAccessory($this);
  243.         }
  244.         return $this;
  245.     }
  246.     public function removePfosten(Pfosten $pfosten): self
  247.     {
  248.         if ($this->pfostens->removeElement($pfosten)) {
  249.             $pfosten->removeAccessory($this);
  250.         }
  251.         return $this;
  252.     }
  253.     /**
  254.      * @return Collection|Terrasse[]
  255.      */
  256.     public function getTerrasses(): Collection|array
  257.     {
  258.         return $this->terrasses;
  259.     }
  260.     public function addTerrass(Terrasse $terrass): self
  261.     {
  262.         if (!$this->terrasses->contains($terrass)) {
  263.             $this->terrasses[] = $terrass;
  264.             $terrass->addAccessory($this);
  265.         }
  266.         return $this;
  267.     }
  268.     public function removeTerrass(Terrasse $terrass): self
  269.     {
  270.         if ($this->terrasses->removeElement($terrass)) {
  271.             $terrass->removeAccessory($this);
  272.         }
  273.         return $this;
  274.     }
  275.     /**
  276.      * @return Collection|Zaunelement[]
  277.      */
  278.     public function getZaunelements(): Collection|array
  279.     {
  280.         return $this->zaunelements;
  281.     }
  282.     public function addZaunelement(Zaunelement $zaunelement): self
  283.     {
  284.         if (!$this->zaunelements->contains($zaunelement)) {
  285.             $this->zaunelements[] = $zaunelement;
  286.             $zaunelement->addAccessory($this);
  287.         }
  288.         return $this;
  289.     }
  290.     public function removeZaunelement(Zaunelement $zaunelement): self
  291.     {
  292.         if ($this->zaunelements->removeElement($zaunelement)) {
  293.             $zaunelement->removeAccessory($this);
  294.         }
  295.         return $this;
  296.     }
  297.     /**
  298.      * @return Collection|Material[]
  299.      */
  300.     public function getAccessoryMaterials(): Collection|array
  301.     {
  302.         return $this->accessoryMaterials;
  303.     }
  304.     public function addAccessoryMaterial(AccessoriesMaterials $accessoriesMaterial): self
  305.     {
  306.         if (!$this->accessoryMaterials->contains($accessoriesMaterial)) {
  307.             $this->accessoryMaterials[] = $accessoriesMaterial;
  308.             $accessoriesMaterial->setAccessoryId($this);
  309.         }
  310.         return $this;
  311.     }
  312.     public function removeAccessoryMaterial(AccessoriesMaterials $accessoriesMaterial): self
  313.     {
  314.         if ($this->accessoryMaterials->removeElement($accessoriesMaterial)) {
  315.             // set the owning side to null (unless already changed)
  316.             if ($accessoriesMaterial->getAccessoryId() === $this) {
  317.                 $accessoriesMaterial->setAccessoryId(null);
  318.             }
  319.         }
  320.         return $this;
  321.     }
  322.     public function getUpdatedAt(): ?\DateTimeInterface
  323.     {
  324.         return $this->updated_at;
  325.     }
  326.     public function setUpdatedAt(?\DateTimeInterface $updated_at): self
  327.     {
  328.         $this->updated_at $updated_at;
  329.         return $this;
  330.     }
  331.     public function getDefaultMaterialCombination(): ?AccessoriesMaterials
  332.     {
  333.         return $this->default_material_combination;
  334.     }
  335.     public function setDefaultMaterialCombination(?AccessoriesMaterials $default_material_combination): self
  336.     {
  337.         $this->default_material_combination $default_material_combination;
  338.         return $this;
  339.     }
  340.     /**
  341.      * @return Collection<int, self>
  342.      */
  343.     public function getAccessories(): Collection
  344.     {
  345.         return $this->accessories;
  346.     }
  347.     public function addAccessory(self $accessory): static
  348.     {
  349.         if (!$this->accessories->contains($accessory)) {
  350.             $this->accessories->add($accessory);
  351.         }
  352.         return $this;
  353.     }
  354.     public function removeAccessory(self $accessory): static
  355.     {
  356.         $this->accessories->removeElement($accessory);
  357.         return $this;
  358.     }
  359. }