src/Entity/Pfosten.php line 15

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PfostenRepository;
  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(repositoryClassPfostenRepository::class)]
  11. #[Vich\Uploadable]
  12. class Pfosten
  13. {
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column(type"integer")]
  17.     #[Groups(["products"])]
  18.     private $id;
  19.     #[ORM\Column(type"float"nullabletrue)]
  20.     #[Groups(["products"])]
  21.     private $width;
  22.     #[ORM\Column(type"float"nullabletrue)]
  23.     #[Groups(["products"])]
  24.     private $height;
  25.     #[ORM\Column(type"float"nullabletrue)]
  26.     #[Groups(["products"])]
  27.     private $length;
  28.     #[ORM\Column(type"string"length255nullabletrue)]
  29.     #[Groups(["products"])]
  30.     private $model;
  31.     #[Vich\UploadableField(mapping"models"fileNameProperty"model")]
  32.     private $modelFile;
  33.     #[ORM\Column(type"datetime"nullabletrue)]
  34.     #[Groups(["products"])]
  35.     private ?\DateTime $updatedAt;
  36.     #[ORM\OneToOne(mappedBy"recommendedPfosten"targetEntityZaunelement::class, cascade: ["persist""remove"])]
  37.     private $zaunelement;
  38.     #[ORM\ManyToMany(targetEntityMaterial::class, inversedBy"pfosten")]
  39.     #[ORM\JoinTable(name"pfosten_material")]
  40.     private $compatibleMaterial;
  41.     #[ORM\ManyToOne(targetEntityMaterial::class, cascade: ["persist"])]
  42.     #[ORM\JoinColumn(name"default_material_id"referencedColumnName"id")]
  43.     private $defaultMaterial;
  44.     #[ORM\ManyToMany(targetEntityZaunelement::class, inversedBy"pfostens")]
  45.     #[Groups(["products"])]
  46.     private $compatibleZaunelemente;
  47.     #[ORM\ManyToMany(targetEntityProduct::class, mappedBy"pfosten")]
  48.     private $product;
  49.     #[ORM\Column(type"string"length2048nullabletrue)]
  50.     #[Groups(["products"])]
  51.     private $shortDescription;
  52.     #[ORM\Column(type"string"length2048nullabletrue)]
  53.     #[Groups(["products"])]
  54.     private $description;
  55.     #[ORM\Column(type"string"length255nullabletrue)]
  56.     #[Groups(["products"])]
  57.     private $title;
  58.     #[ORM\Column(type"string"length255nullabletrue)]
  59.     #[Groups(["products"])]
  60.     private $thumbnail;
  61.     #[Vich\UploadableField(mapping"product_images"fileNameProperty"thumbnail")]
  62.     private $thumbnailFile;
  63.     #[ORM\Column(type"boolean"nullabletrue)]
  64.     #[Groups(["products"])]
  65.     private $beta;
  66.     #[ORM\Column(type"string"length255nullabletrue)]
  67.     #[Groups(["products"])]
  68.     private $adBanner;
  69.     #[Vich\UploadableField(mapping"product_images"fileNameProperty"adBanner")]
  70.     private $adBannerFile;
  71.     #[ORM\Column(type"string"length2048nullabletrue)]
  72.     #[Groups(["products"])]
  73.     private $adBannerText;
  74.     #[ORM\ManyToMany(targetEntityAccessories::class, inversedBy"pfostens")]
  75.     #[Groups(["products"])]
  76.     private $accessories;
  77.     #[ORM\Column(type"float"nullabletrue)]
  78.     #[Groups(["products"])]
  79.     private $price;
  80.     #[ORM\Column(type"string"length255nullabletrue)]
  81.     #[Groups(["products"])]
  82.     private $articleNumber;
  83.     #[ORM\Column(type"string"length255nullabletrue)]
  84.     #[Groups(["products"])]
  85.     private $fixation_type;
  86.     #[ORM\Column(type"string"length255nullabletrue)]
  87.     #[Groups(["products"])]
  88.     private $material_type;
  89.     #[ORM\Column(type"string"length255nullabletrue)]
  90.     #[Groups(["products"])]
  91.     private $type;
  92.     #[ORM\Column(type"float"nullabletrue)]
  93.     #[Groups(["products"])]
  94.     private $seller_price;
  95.     #[ORM\OneToMany(mappedBy"pfosten_id"targetEntityPfostenMaterials::class, cascade: ["persist""remove"])]
  96.     #[Groups(["products"])]
  97.     private $pfostenMaterials;
  98.     #[ORM\ManyToOne(targetEntityPfostenMaterials::class, inversedBy"pfostens")]
  99.     #[Groups(["products"])]
  100.     private $defaultMaterialCombination;
  101.     #[ORM\Column(type"array"nullabletrue)]
  102.     #[Groups(["products"])]
  103.     private $default_accessory_id = [];
  104.     #[ORM\Column(type"integer"nullabletrue)]
  105.     #[Groups(["products"])]
  106.     private $mounting_angle;
  107.     #[ORM\Column(type"array"nullabletrue)]
  108.     #[Groups(["products"])]
  109.     private $current_accessory_id = [];
  110.     public function __construct()
  111.     {
  112.         $this->compatibleMaterial = new ArrayCollection();
  113.         $this->compatibleZaunelemente = new ArrayCollection();
  114.         $this->accessories = new ArrayCollection();
  115.         $this->pfostenMaterials = new ArrayCollection();
  116.     }
  117.     /**
  118.      * @return mixed
  119.      */
  120.     public function __toString()
  121.     {
  122.         return $this->title ?? '';
  123.     }
  124.     public function getId(): ?int
  125.     {
  126.         return $this->id;
  127.     }
  128.     public function getWidth(): ?float
  129.     {
  130.         return $this->width;
  131.     }
  132.     public function setWidth(?float $width): self
  133.     {
  134.         $this->width $width;
  135.         return $this;
  136.     }
  137.     public function getHeight(): ?float
  138.     {
  139.         return $this->height;
  140.     }
  141.     public function setHeight(?float $height): self
  142.     {
  143.         $this->height $height;
  144.         return $this;
  145.     }
  146.     public function getLength(): ?float
  147.     {
  148.         return $this->length;
  149.     }
  150.     public function setLength(?float $length): self
  151.     {
  152.         $this->length $length;
  153.         return $this;
  154.     }
  155.     public function getModel(): ?string
  156.     {
  157.         return $this->model;
  158.     }
  159.     public function setModel(?string $model): self
  160.     {
  161.         $this->model $model;
  162.         return $this;
  163.     }
  164.     /**
  165.      * @param File|null $model
  166.      */
  167.     public function setModelFile(File $model null)
  168.     {
  169.         $this->modelFile $model;
  170.         // VERY IMPORTANT:
  171.         // It is required that at least one field changes if you are using Doctrine,
  172.         // otherwise the event listeners won't be called and the file is lost
  173.         if ($model) {
  174.             // if 'updatedAt' is not defined in your entity, use another property
  175.             $this->updatedAt = new \DateTime('now');
  176.         }
  177.     }
  178.     /**
  179.      * @return File
  180.      */
  181.     public function getModelFile()
  182.     {
  183.         return $this->modelFile;
  184.     }
  185.     public function getZaunelement(): ?Zaunelement
  186.     {
  187.         return $this->zaunelement;
  188.     }
  189.     public function setZaunelement(?Zaunelement $zaunelement): self
  190.     {
  191.         // unset the owning side of the relation if necessary
  192.         if ($zaunelement === null && $this->zaunelement !== null) {
  193.             $this->zaunelement->setRecommendedPfosten(null);
  194.         }
  195.         // set the owning side of the relation if necessary
  196.         if ($zaunelement !== null && $zaunelement->getRecommendedPfosten() !== $this) {
  197.             $zaunelement->setRecommendedPfosten($this);
  198.         }
  199.         $this->zaunelement $zaunelement;
  200.         return $this;
  201.     }
  202.     /**
  203.      * @return null|\DateTime
  204.      */
  205.     public function getUpdatedAt(): ?\DateTime
  206.     {
  207.         return $this->updatedAt;
  208.     }
  209.     /**
  210.      * @param \DateTime|null $updatedAt
  211.      * @return $this
  212.      */
  213.     public function setUpdatedAt(?\DateTime $updatedAt): static
  214.     {
  215.         $this->updatedAt $updatedAt;
  216.         return $this;
  217.     }
  218.     /**
  219.      * @return Collection|Material[]
  220.      */
  221.     public function getCompatibleMaterial(): Collection|array
  222.     {
  223.         return $this->compatibleMaterial;
  224.     }
  225.     public function addCompatibleMaterial(Material $compatibleMaterial): self
  226.     {
  227.         if (!$this->compatibleMaterial->contains($compatibleMaterial)) {
  228.             $this->compatibleMaterial[] = $compatibleMaterial;
  229.             $compatibleMaterial->setPfosten($this);
  230.         }
  231.         return $this;
  232.     }
  233.     public function removeCompatibleMaterial(Material $compatibleMaterial): self
  234.     {
  235.         if ($this->compatibleMaterial->removeElement($compatibleMaterial)) {
  236.             // set the owning side to null (unless already changed)
  237.             if ($compatibleMaterial->getPfosten() === $this) {
  238.                 $compatibleMaterial->setPfosten(null);
  239.             }
  240.         }
  241.         return $this;
  242.     }
  243.     public function getDefaultMaterial(): ?Material
  244.     {
  245.         return $this->defaultMaterial;
  246.     }
  247.     public function setDefaultMaterial(?Material $defaultMaterial): self
  248.     {
  249.         $this->defaultMaterial $defaultMaterial;
  250.         return $this;
  251.     }
  252.     /**
  253.      * @return Collection|Zaunelement[]
  254.      */
  255.     public function getCompatibleZaunelemente(): Collection|array
  256.     {
  257.         return $this->compatibleZaunelemente;
  258.     }
  259.     public function addCompatibleZaunelemente(Zaunelement $compatibleZaunelemente): self
  260.     {
  261.         if (!$this->compatibleZaunelemente->contains($compatibleZaunelemente)) {
  262.             $this->compatibleZaunelemente[] = $compatibleZaunelemente;
  263.         }
  264.         return $this;
  265.     }
  266.     public function removeCompatibleZaunelemente(Zaunelement $compatibleZaunelemente): self
  267.     {
  268.         $this->compatibleZaunelemente->removeElement($compatibleZaunelemente);
  269.         return $this;
  270.     }
  271.     public function getProduct(): ?Product
  272.     {
  273.         return $this->product;
  274.     }
  275.     public function setProduct(?Product $product): void
  276.     {
  277.         $this->product->clear();
  278.         $this->product = new ArrayCollection($product);
  279.     }
  280.     /**
  281.      * Add a product in the category.
  282.      *
  283.      * @param $product Product The product to associate
  284.      */
  285.     public function addProduct($product)
  286.     {
  287.         if ($this->product->contains($product)) {
  288.             return;
  289.         }
  290.         $this->product->add($product);
  291.         $product->addPfosten($this);
  292.     }
  293.     /**
  294.      * @param Product $product
  295.      */
  296.     public function removeProduct($product)
  297.     {
  298.         if (!$this->product->contains($product)) {
  299.             return;
  300.         }
  301.         $this->product->removeElement($product);
  302.         $product->removePfosten($this);
  303.     }
  304.     public function getShortDescription(): ?string
  305.     {
  306.         return $this->shortDescription;
  307.     }
  308.     public function setShortDescription(?string $shortDescription): self
  309.     {
  310.         $this->shortDescription $shortDescription;
  311.         return $this;
  312.     }
  313.     public function getDescription(): ?string
  314.     {
  315.         return $this->description;
  316.     }
  317.     public function setDescription(?string $description): self
  318.     {
  319.         $this->description $description;
  320.         return $this;
  321.     }
  322.     public function getTitle(): ?string
  323.     {
  324.         return $this->title;
  325.     }
  326.     public function setTitle(?string $title): self
  327.     {
  328.         $this->title $title;
  329.         return $this;
  330.     }
  331.     public function getThumbnail(): ?string
  332.     {
  333.         return $this->thumbnail;
  334.     }
  335.     public function setThumbnail(?string $thumbnail): self
  336.     {
  337.         $this->thumbnail $thumbnail;
  338.         return $this;
  339.     }
  340.     public function getBeta(): ?bool
  341.     {
  342.         return $this->beta;
  343.     }
  344.     public function setBeta(?bool $beta): self
  345.     {
  346.         $this->beta $beta;
  347.         return $this;
  348.     }
  349.     public function getAdBanner(): ?string
  350.     {
  351.         return $this->adBanner;
  352.     }
  353.     public function setAdBanner(?string $adBanner): self
  354.     {
  355.         $this->adBanner $adBanner;
  356.         return $this;
  357.     }
  358.     public function getAdBannerText(): ?string
  359.     {
  360.         return $this->adBannerText;
  361.     }
  362.     public function setAdBannerText(?string $adBannerText): self
  363.     {
  364.         $this->adBannerText $adBannerText;
  365.         return $this;
  366.     }
  367.     /**
  368.      * @param null|File $image
  369.      */
  370.     public function setAdBannerFile(File $image null)
  371.     {
  372.         $this->adBannerFile $image;
  373.         // VERY IMPORTANT:
  374.         // It is required that at least one field changes if you are using Doctrine,
  375.         // otherwise the event listeners won't be called and the file is lost
  376.         if ($image) {
  377.             // if 'updatedAt' is not defined in your entity, use another property
  378.             $this->updatedAt = new \DateTime('now');
  379.         }
  380.     }
  381.     /**
  382.      * @return null|File
  383.      */
  384.     public function getAdBannerFile(): ?File
  385.     {
  386.         return $this->adBannerFile;
  387.     }
  388.     /**
  389.      * @param null|File $image
  390.      */
  391.     public function setThumbnailFile(File $image null)
  392.     {
  393.         $this->thumbnailFile $image;
  394.         // VERY IMPORTANT:
  395.         // It is required that at least one field changes if you are using Doctrine,
  396.         // otherwise the event listeners won't be called and the file is lost
  397.         if ($image) {
  398.             // if 'updatedAt' is not defined in your entity, use another property
  399.             $this->updatedAt = new \DateTime('now');
  400.         }
  401.     }
  402.     /**
  403.      * @return null|File
  404.      */
  405.     public function getThumbnailFile(): ?File
  406.     {
  407.         return $this->thumbnailFile;
  408.     }
  409.     /**
  410.      * @return Collection|Accessories[]
  411.      */
  412.     public function getAccessories(): Collection|array
  413.     {
  414.         return $this->accessories;
  415.     }
  416.     public function addAccessory(Accessories $accessory): self
  417.     {
  418.         if (!$this->accessories->contains($accessory)) {
  419.             $this->accessories[] = $accessory;
  420.         }
  421.         return $this;
  422.     }
  423.     public function removeAccessory(Accessories $accessory): self
  424.     {
  425.         $this->accessories->removeElement($accessory);
  426.         return $this;
  427.     }
  428.     public function getPrice(): ?float
  429.     {
  430.         return $this->price;
  431.     }
  432.     public function setPrice(?float $price): self
  433.     {
  434.         $this->price $price;
  435.         return $this;
  436.     }
  437.     public function getArticleNumber(): ?string
  438.     {
  439.         return $this->articleNumber;
  440.     }
  441.     public function setArticleNumber(?string $articleNumber): self
  442.     {
  443.         $this->articleNumber $articleNumber;
  444.         return $this;
  445.     }
  446.     public function getFixationType(): ?string
  447.     {
  448.         return $this->fixation_type;
  449.     }
  450.     public function setFixationType(?string $fixation_type): self
  451.     {
  452.         $this->fixation_type $fixation_type;
  453.         return $this;
  454.     }
  455.     public function getMaterialType(): ?string
  456.     {
  457.         return $this->material_type;
  458.     }
  459.     public function setMaterialType(?string $material_type): self
  460.     {
  461.         $this->material_type $material_type;
  462.         return $this;
  463.     }
  464.     public function getType(): ?string
  465.     {
  466.         return $this->type;
  467.     }
  468.     public function setType(?string $type): self
  469.     {
  470.         $this->type $type;
  471.         return $this;
  472.     }
  473.     public function getSellerPrice(): ?float
  474.     {
  475.         return $this->seller_price;
  476.     }
  477.     public function setSellerPrice(?float $seller_price): self
  478.     {
  479.         $this->seller_price $seller_price;
  480.         return $this;
  481.     }
  482.     /**
  483.      * @return Collection|PfostenMaterials []
  484.      */
  485.     public function getPfostenMaterials(): Collection|PfostenMaterials
  486.     {
  487.         return $this->pfostenMaterials;
  488.     }
  489.     public function addPfostenMaterial(PfostenMaterials $pfostenMaterial): self
  490.     {
  491.         if (!$this->pfostenMaterials->contains($pfostenMaterial)) {
  492.             $this->pfostenMaterials[] = $pfostenMaterial;
  493.             $pfostenMaterial->setPfostenId($this);
  494.         }
  495.         return $this;
  496.     }
  497.     public function removePfostenMaterial(PfostenMaterials $pfostenMaterial): self
  498.     {
  499.         if ($this->pfostenMaterials->removeElement($pfostenMaterial)) {
  500.             // set the owning side to null (unless already changed)
  501.             if ($pfostenMaterial->getPfostenId() === $this) {
  502.                 $pfostenMaterial->setPfostenId(null);
  503.             }
  504.         }
  505.         return $this;
  506.     }
  507.     public function getDefaultMaterialCombination(): ?PfostenMaterials
  508.     {
  509.         return $this->defaultMaterialCombination;
  510.     }
  511.     public function setDefaultMaterialCombination(?PfostenMaterials $defaultMaterialCombination): self
  512.     {
  513.         $this->defaultMaterialCombination $defaultMaterialCombination;
  514.         return $this;
  515.     }
  516.     public function getDefaultAccessoryId(): ?array
  517.     {
  518.         return $this->default_accessory_id;
  519.     }
  520.     public function setDefaultAccessoryId(?array $default_accessory_id): self
  521.     {
  522.         $this->default_accessory_id $default_accessory_id;
  523.         return $this;
  524.     }
  525.     public function getMountingAngle(): ?int
  526.     {
  527.         return $this->mounting_angle;
  528.     }
  529.     public function setMountingAngle(?int $mounting_angle): self
  530.     {
  531.         $this->mounting_angle $mounting_angle;
  532.         return $this;
  533.     }
  534.     public function getCurrentAccessoryId(): ?array
  535.     {
  536.         return $this->current_accessory_id;
  537.     }
  538.     public function setCurrentAccessoryId(?array $current_accessory_id): self
  539.     {
  540.         $this->current_accessory_id $current_accessory_id;
  541.         return $this;
  542.     }
  543. }