src/Entity/Product.php line 23
<?php/** This file is part of the Doctrine-TestSet project created by* https://github.com/MacFJA** For the full copyright and license information, please view the LICENSE* at https://github.com/MacFJA/Doctrine-TestSet*/namespace App\Entity;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\HttpFoundation\File\File;use Symfony\Component\Serializer\Annotation\Groups;use Vich\UploaderBundle\Mapping\Annotation as Vich;#[ORM\Entity]#[Vich\Uploadable]class Product{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column(name: "id", type: "integer")]#[Groups(["products"])]private $id = null;#[ORM\Column(type: "datetime", name: "created_at")]#[Groups(["products"])]private $createdAt = null;#[ORM\Column(type: "boolean")]#[Groups(["products"])]private $enabled = false;#[ORM\Column(type: "string", length: 255, nullable: true)]#[Groups(["products"])]private $thumbnail;#[Vich\UploadableField(mapping: "product_images", fileNameProperty: "thumbnail")]private $thumbnailFile;#[ORM\Column(type: "datetime", nullable: true)]#[Groups(["products"])]private $updatedAt;#[ORM\Column(type: "string")]#[Groups(["products"])]private $name;#[ORM\Column(type: "text", length: 2048, nullable: true)]#[Groups(["products"])]private $shortDescription;#[ORM\ManyToMany(targetEntity: Category::class, inversedBy: "products")]#[ORM\JoinTable(name: "product_category")]#[Groups(["products"])]private $categories;#[ORM\Column(type: "string", length: 2048, nullable: true)]#[Groups(["products"])]private $longDescription;#[ORM\Column(type: "boolean", nullable: true)]#[Groups(["products"])]private $beta;#[ORM\Column(type: "boolean", nullable: true)]#[Groups(["products"])]private $recommended;#[ORM\ManyToMany(targetEntity: Pfosten::class, inversedBy: "product")]#[ORM\JoinTable(name: "product_pfosten")]#[Groups(["products"])]private $pfosten;#[ORM\ManyToMany(targetEntity: Zaunelement::class, inversedBy: "product")]#[ORM\JoinTable(name: "product_zaunelement")]#[Groups(["products"])]private $zaunelemente;#[ORM\ManyToMany(targetEntity: Terrasse::class, inversedBy: "product")]#[ORM\JoinTable(name: "product_terrasse")]#[Groups(["products"])]private $terrassen;#[ORM\Column(type: "string", length: 2048, nullable: true)]#[Groups(["products"])]private $adBannerText;#[ORM\Column(type: "string", length: 255, nullable: true)]#[Groups(["products"])]private $adBanner;#[ORM\Column(type: "string", length: 255, nullable: true)]#[Groups(["products"])]private $recommendedText;#[Vich\UploadableField(mapping: "product_images", fileNameProperty: "adBanner")]private $adBannerFile;#[ORM\Column(type: "integer", nullable: true)]#[Groups(["products"])]private $default_pfosten_id = [];#[ORM\Column(type: "integer", nullable: true)]#[Groups(["products"])]private $default_zaunelement_id = [];#[ORM\Column(type: "boolean", nullable: true)]#[Groups(["products"])]private $pluggable;#[ORM\Column(type: "integer", nullable: true)]#[Groups(["products"])]private $position;public function __construct(){$this->categories = new ArrayCollection();$this->createdAt = new \DateTime();$this->pfosten = new ArrayCollection();$this->zaunelemente = new ArrayCollection();$this->terrassen = new ArrayCollection();}/*** Add a category in the product association.* (Owning side).** @param $category Category the category to associate*/public function addCategory($category){if ($this->categories->contains($category)) {return;}$this->categories->add($category);$category->addProduct($this);}/*** Remove a category in the product association.* (Owning side).** @param $category Category the category to associate*/public function removeCategory($category){if (!$this->categories->contains($category)) {return;}$this->categories->removeElement($category);$category->removeProduct($this);}/*** Set the shortDescription of the product.** @param string $shortDescription*/public function setShortDescription($shortDescription){$this->shortDescription = $shortDescription;}/*** The the full shortDescription of the product.** @return string*/public function getShortDescription(){return $this->shortDescription;}/*** Set if the product is enable.** @param bool $enabled*/public function setEnabled($enabled){$this->enabled = $enabled;}/*** Is the product enabled?** @return bool*/public function getEnabled(){return $this->enabled;}/*** Alias of getEnabled.** @return bool*/public function isEnabled(){return $this->getEnabled();}/*** @param File|null $image*/public function setThumbnailFile(File $image = null){$this->thumbnailFile = $image;// VERY IMPORTANT:// It is required that at least one field changes if you are using Doctrine,// otherwise the event listeners won't be called and the file is lostif ($image) {// if 'updatedAt' is not defined in your entity, use another property$this->updatedAt = new \DateTime('now');}}/*** @return File*/public function getThumbnailFile(){return $this->thumbnailFile;}/*** @param string $image*/public function setThumbnail($image){$this->thumbnail = $image;}/*** @return string*/public function getThumbnail(){return $this->thumbnail;}/*** Set the product name.** @param string $name*/public function setName($name){$this->name = $name;}/*** Retrieve the name of the product.** @return string*/public function getName(){return $this->name;}/*** Get all associated categories.** @return Category[]*/public function getCategories(){return $this->categories;}/*** Set all categories of the product.** @param Category[] $categories*/public function setCategories($categories){// This is the owning side, we have to call remove and add to have change in the category side too.foreach ($this->getCategories() as $category) {$this->removeCategory($category);}foreach ($categories as $category) {$this->addCategory($category);}}/*** @return \DateTime*/public function getCreatedAt(){if(!$this->createdAt) {$this->createdAt = new \DateTime();}return $this->createdAt;}/****/public function setCreatedAt(\DateTime $createdAt): void{$this->createdAt = $createdAt;}/*** Get the id of the product.** @return int*/public function getId(){return $this->id;}/*** {@inheritdoc}*/public function __toString(){return $this->getName() ?? '';}/*** @return string|null*/public function getLongDescription(): ?string{return $this->longDescription;}/*** @param string|null $longDescription* @return $this*/public function setLongDescription(?string $longDescription): static{$this->longDescription = $longDescription;return $this;}/*** @return bool|null*/public function getBeta(): ?bool{return $this->beta;}/*** @param bool|null $beta* @return $this*/public function setBeta(?bool $beta): static{$this->beta = $beta;return $this;}/*** @return bool|null*/public function getRecommended(): ?bool{return $this->recommended;}/*** @param bool|null $recommended* @return $this*/public function setRecommended(?bool $recommended): static{$this->recommended = $recommended;return $this;}/*** @return \DateTime*/public function getUpdatedAt(): \DateTime{return $this->updatedAt;}/*** @param \DateTime|null $updatedAt* @return $this*/public function setUpdatedAt(?\DateTime $updatedAt): static{$this->updatedAt = $updatedAt;return $this;}/*** @return Collection|Pfosten[]*/public function getPfosten(): Collection|array{return $this->pfosten;}/*** Set all categories of the product.** @param array $pfostens*/public function setPfosten(array $pfostens){// This is the owning side, we have to call remove and add to have change in the category side too.foreach ($this->getPfosten() as $pfosten) {$this->removePfosten($pfosten);}foreach ($pfostens as $pfosten) {$this->addPfosten($pfosten);}}public function addPfosten(Pfosten $pfosten){if ($this->pfosten->contains($pfosten)) {return;}$this->pfosten->add($pfosten);$pfosten->addProduct($this);}public function removePfosten(Pfosten $pfosten){if (!$this->pfosten->contains($pfosten)) {return;}$this->pfosten->removeElement($pfosten);$pfosten->removeProduct($this);}/*** @return Collection|Zaunelement[]*/public function getZaunelemente(): Collection|array{return $this->zaunelemente;}/*** Set all Zaunelemente of the product.** @param array $zaunelemente*/public function setZaunelemente(array $zaunelemente){// This is the owning side, we have to call remove and add to have change in the category side too.foreach ($this->getZaunelemente() as $zaunelement) {$this->removeZaunelemente($zaunelement);}foreach ($zaunelemente as $zaunelement) {$this->addZaunelemente($zaunelement);}}public function addZaunelemente(Zaunelement $zaunelemente){if ($this->zaunelemente->contains($zaunelemente)) {return;}$this->zaunelemente->add($zaunelemente);$zaunelemente->addProduct($this);}public function removeZaunelemente(Zaunelement $zaunelemente){if (!$this->zaunelemente->contains($zaunelemente)) {return;}$this->zaunelemente->removeElement($zaunelemente);$zaunelemente->removeProduct($this);}/*** @return Collection|Terrasse[]*/public function getTerrassen(): Collection|array{return $this->terrassen;}/*** Set all Terrassen of the product.** @param array $terrassen*/public function setTerrassen(array $terrassen){// This is the owning side, we have to call remove and add to have change in the category side too.foreach ($this->getTerrassen() as $terrasse) {$this->removeTerrassen($terrasse);}foreach ($terrassen as $terrasse) {$this->addTerrassen($terrasse);}}public function addTerrassen(Terrasse $terrassen){if ($this->terrassen->contains($terrassen)) {return;}$this->terrassen->add($terrassen);$terrassen->addProduct($this);}public function removeTerrassen(Terrasse $terrassen){if (!$this->terrassen->contains($terrassen)) {return;}$this->terrassen->removeElement($terrassen);$terrassen->removeProduct($this);}public function getAdBannerText(): ?string{return $this->adBannerText;}public function setAdBannerText(?string $adBannerText): self{$this->adBannerText = $adBannerText;return $this;}public function getAdBanner(): ?string{return $this->adBanner;}public function setAdBanner(?string $adBanner): self{$this->adBanner = $adBanner;return $this;}/*** @param null|File $image*/public function setAdBannerFile(File $image = null){$this->adBannerFile = $image;// VERY IMPORTANT:// It is required that at least one field changes if you are using Doctrine,// otherwise the event listeners won't be called and the file is lostif ($image) {// if 'updatedAt' is not defined in your entity, use another property$this->updatedAt = new \DateTime('now');}}/*** @return null|File*/public function getAdBannerFile(): ?File{return $this->adBannerFile;}public function getRecommendedText(): ?string{return $this->recommendedText;}public function setRecommendedText(?string $recommendedText): self{$this->recommendedText = $recommendedText;return $this;}public function getDefaultPfostenId(): ?int{return $this->default_pfosten_id;}public function setDefaultPfostenId(?int $default_pfosten_id): self{$this->default_pfosten_id = $default_pfosten_id;return $this;}public function getDefaultZaunelementId(): ?int{return $this->default_zaunelement_id;}public function setDefaultZaunelementId(?int $default_zaunelement_id): self{$this->default_zaunelement_id = $default_zaunelement_id;return $this;}public function getPluggable(): ?bool{return $this->pluggable;}public function setPluggable(?bool $pluggable): self{$this->pluggable = $pluggable;return $this;}public function getPosition(): ?int{return $this->position;}public function setPosition(?int $position): self{$this->position = $position;return $this;}}