src/Entity/ZaunelementMaterials.php line 16

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ZaunelementMaterialRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  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(repositoryClassZaunelementMaterialRepository::class)]
  12. #[Vich\Uploadable]
  13. class ZaunelementMaterials
  14. {
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue]
  17.     #[ORM\Column(type"integer")]
  18.     private $id;
  19.     #[ORM\ManyToOne(targetEntityZaunelement::class, inversedBy"zaunelementMaterials")]
  20.     #[ORM\JoinColumn(nullabletrueonDelete"CASCADE")]
  21.     private $zaunelement_id;
  22.     #[ORM\Column(type"string"length255nullabletrue)]
  23.     #[Groups(["products"])]
  24.     private $article_number;
  25.     #[ORM\Column(type"float"nullabletrue)]
  26.     #[Groups(["products"])]
  27.     private $price;
  28.     #[ORM\ManyToOne(targetEntityMaterial::class)]
  29.     #[Groups(["products"])]
  30.     private $material_id;
  31.     #[ORM\Column(type"string"length255nullabletrue)]
  32.     #[Groups(["products"])]
  33.     private $thumbnail;
  34.     #[Vich\UploadableField(mapping"product_images"fileNameProperty"thumbnail")]
  35.     private $thumbnailFile;
  36.     #[ORM\Column(type"datetime_immutable"nullabletrue)]
  37.     #[Groups(["products"])]
  38.     private $updated_at;
  39.     #[ORM\Column(type"string"length255nullabletrue)]
  40.     #[Groups(["products"])]
  41.     private $title;
  42.     #[ORM\ManyToOne(targetEntityMaterial::class)]
  43.     #[Groups(["products"])]
  44.     private $secondary_material_id;
  45.     #[ORM\Column(type"float"nullabletrue)]
  46.     private $seller_price;
  47.     #[ORM\OneToMany(targetEntityZaunelement::class, mappedBy"defaultMaterialCombination")]
  48.     private $zaunelement;
  49.     #[ORM\Column(type"string"length255nullabletrue)]
  50.     #[Groups(["products"])]
  51.     private $article_number_l;
  52.     #[ORM\Column(length255nullabletrue)]
  53.     #[Groups(["products"])]
  54.     private ?string $articleNumberSpecialSizeR null;
  55.     #[ORM\Column(length255nullabletrue)]
  56.     #[Groups(["products"])]
  57.     private ?string $articleNumberSpecialSizeL null;
  58.     #[ORM\Column(typeTypes::DECIMALprecision10scale2nullabletrue)]
  59.     #[Groups(["products"])]
  60.     private ?string $priceSpecialSize null;
  61.     #[ORM\Column(typeTypes::DECIMALprecision10scale2nullabletrue)]
  62.     #[Groups(["products"])]
  63.     private ?string $sellerPriceSpecialSize null;
  64.     public function __construct()
  65.     {
  66.         $this->zaunelement = new ArrayCollection();
  67.     }
  68.     public function __toString()
  69.     {
  70.         return $this->title ?? '';
  71.     }
  72.     public function getId(): ?int
  73.     {
  74.         return $this->id;
  75.     }
  76.     public function getZaunelementId(): ?Zaunelement
  77.     {
  78.         return $this->zaunelement_id;
  79.     }
  80.     public function setZaunelementId(?Zaunelement $zaunelement_id): self
  81.     {
  82.         $this->zaunelement_id $zaunelement_id;
  83.         return $this;
  84.     }
  85.     public function getArticleNumber(): ?string
  86.     {
  87.         return $this->article_number;
  88.     }
  89.     public function setArticleNumber(?string $article_number): self
  90.     {
  91.         $this->article_number $article_number;
  92.         return $this;
  93.     }
  94.     public function getPrice(): ?float
  95.     {
  96.         return $this->price;
  97.     }
  98.     public function setPrice(?float $price): self
  99.     {
  100.         $this->price $price;
  101.         return $this;
  102.     }
  103.     public function getMaterialId(): ?Material
  104.     {
  105.         return $this->material_id;
  106.     }
  107.     public function setMaterialId(?Material $material_id): self
  108.     {
  109.         $this->material_id $material_id;
  110.         return $this;
  111.     }
  112.     public function getThumbnail(): ?string
  113.     {
  114.         return $this->thumbnail;
  115.     }
  116.     public function setThumbnail(?string $thumbnail): self
  117.     {
  118.         $this->thumbnail $thumbnail;
  119.         return $this;
  120.     }
  121.     /**
  122.      * @param null|File $image
  123.      */
  124.     public function setThumbnailFile(File $image null)
  125.     {
  126.         $this->thumbnailFile $image;
  127.         // VERY IMPORTANT:
  128.         // It is required that at least one field changes if you are using Doctrine,
  129.         // otherwise the event listeners won't be called and the file is lost
  130.         if ($image) {
  131.             // if 'updatedAt' is not defined in your entity, use another property
  132.             $this->updated_at = new \DateTimeImmutable('now');
  133.         }
  134.     }
  135.     /**
  136.      * @return null|File
  137.      */
  138.     public function getThumbnailFile(): ?File
  139.     {
  140.         return $this->thumbnailFile;
  141.     }
  142.     public function getUpdatedAt(): ?\DateTimeImmutable
  143.     {
  144.         return $this->updated_at;
  145.     }
  146.     public function setUpdatedAt(?\DateTimeImmutable $updated_at): self
  147.     {
  148.         $this->updated_at $updated_at;
  149.         return $this;
  150.     }
  151.     public function getTitle(): ?string
  152.     {
  153.         return $this->title;
  154.     }
  155.     public function setTitle(?string $title): self
  156.     {
  157.         $this->title $title;
  158.         return $this;
  159.     }
  160.     public function getSecondaryMaterialId(): ?Material
  161.     {
  162.         return $this->secondary_material_id;
  163.     }
  164.     public function setSecondaryMaterialId(?Material $secondary_material_id): self
  165.     {
  166.         $this->secondary_material_id $secondary_material_id;
  167.         return $this;
  168.     }
  169.     public function getSellerPrice(): ?float
  170.     {
  171.         return $this->seller_price;
  172.     }
  173.     public function setSellerPrice(?float $seller_price): self
  174.     {
  175.         $this->seller_price $seller_price;
  176.         return $this;
  177.     }
  178.     /**
  179.      * @return Collection|Zaunelement[]
  180.      */
  181.     public function getZaunelement(): Collection|array
  182.     {
  183.         return $this->zaunelement;
  184.     }
  185.     public function addZaunelement(Zaunelement $zaunelement): self
  186.     {
  187.         if (!$this->zaunelement->contains($zaunelement)) {
  188.             $this->zaunelement[] = $zaunelement;
  189.             $zaunelement->setDefaultMaterialCombination($this);
  190.         }
  191.         return $this;
  192.     }
  193.     public function removeZaunelement(Zaunelement $zaunelement): self
  194.     {
  195.         if ($this->zaunelement->removeElement($zaunelement)) {
  196.             // set the owning side to null (unless already changed)
  197.             if ($zaunelement->getDefaultMaterialCombination() === $this) {
  198.                 $zaunelement->setDefaultMaterialCombination(null);
  199.             }
  200.         }
  201.         return $this;
  202.     }
  203.     public function getArticleNumberL(): ?string
  204.     {
  205.         return $this->article_number_l;
  206.     }
  207.     public function setArticleNumberL(?string $article_number_l): self
  208.     {
  209.         $this->article_number_l $article_number_l;
  210.         return $this;
  211.     }
  212.     public function getArticleNumberSpecialSizeR(): ?string
  213.     {
  214.         return $this->articleNumberSpecialSizeR;
  215.     }
  216.     public function setArticleNumberSpecialSizeR(?string $articleNumberSpecialSizeR): static
  217.     {
  218.         $this->articleNumberSpecialSizeR $articleNumberSpecialSizeR;
  219.         return $this;
  220.     }
  221.     public function getArticleNumberSpecialSizeL(): ?string
  222.     {
  223.         return $this->articleNumberSpecialSizeL;
  224.     }
  225.     public function setArticleNumberSpecialSizeL(?string $articleNumberSpecialSizeL): static
  226.     {
  227.         $this->articleNumberSpecialSizeL $articleNumberSpecialSizeL;
  228.         return $this;
  229.     }
  230.     public function getPriceSpecialSize(): ?string
  231.     {
  232.         return $this->priceSpecialSize;
  233.     }
  234.     public function setPriceSpecialSize(?string $priceSpecialSize): static
  235.     {
  236.         $this->priceSpecialSize $priceSpecialSize;
  237.         return $this;
  238.     }
  239.     public function getSellerPriceSpecialSize(): ?string
  240.     {
  241.         return $this->sellerPriceSpecialSize;
  242.     }
  243.     public function setSellerPriceSpecialSize(?string $sellerPriceSpecialSize): static
  244.     {
  245.         $this->sellerPriceSpecialSize $sellerPriceSpecialSize;
  246.         return $this;
  247.     }
  248. }