src/Entity/Zaunelement.php line 16

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