src/Entity/Product.php line 24

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiFilter;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use App\Repository\ProductRepository;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
  9. /**
  10.  * @ApiResource(normalizationContext={"groups"={"Product_read"}},
  11.  *     itemOperations={"get"},
  12.  *     collectionOperations={"get"})
  13.  * @ApiFilter(SearchFilter::class, properties={
  14.  *     "colour": "exact",
  15.  *     "category": "exact",
  16.  *     "manufacturer": "exact",
  17.  * })
  18.  * @ORM\Entity(repositoryClass=ProductRepository::class)
  19.  */
  20. class Product
  21. {
  22.     /**
  23.      * @ORM\Id
  24.      * @ORM\GeneratedValue
  25.      * @ORM\Column(type="integer")
  26.      * @Groups({"Product_read"})
  27.      */
  28.     private $id;
  29.     /**
  30.      * @Groups({"Product_read"})
  31.      * @ORM\Column(type="string", length=255)
  32.      */
  33.     private $name;
  34.     /**
  35.      * @Groups({"Product_read"})
  36.      * @ORM\Column(type="string", length=255)
  37.      */
  38.     private $image;
  39.     /**
  40.      * @Groups({"Product_read"})
  41.      * @ORM\Column(type="string", length=255)
  42.      */
  43.     private $articlenumber;
  44.     /**
  45.      * @Groups({"Product_read"})
  46.      * @ORM\Column(type="string", length=255)
  47.      */
  48.     private $numberofremaining;
  49.     /**
  50.      * @Groups({"Product_read"})
  51.      * @ORM\Column(type="text")
  52.      */
  53.     private $description;
  54.     /**
  55.      * @Groups({"Product_read"})
  56.      * @ORM\Column(type="string", length=255)
  57.      */
  58.     private $price;
  59.     /**
  60.      * @Groups({"Product_read"})
  61.      * @ORM\Column(type="string", length=255)
  62.      */
  63.     private $timeofdelivery;
  64.     /**
  65.      * @ORM\ManyToOne(targetEntity=Colour::class, inversedBy="products")
  66.      * @ORM\JoinColumn(nullable=false)
  67.      */
  68.     private $colour;
  69.     /**
  70.      * @ORM\ManyToOne(targetEntity=Model::class, inversedBy="products")
  71.      * @ORM\JoinColumn(nullable=false)
  72.      */
  73.     private $model;
  74.     /**
  75.      * @ORM\ManyToOne(targetEntity=Manufacturer::class, inversedBy="products")
  76.      * @ORM\JoinColumn(nullable=false)
  77.      */
  78.     private $manufacturer;
  79.     /**
  80.      * @ORM\ManyToOne(targetEntity=OperatingSystem::class, inversedBy="products")
  81.      * @ORM\JoinColumn(nullable=false)
  82.      */
  83.     private $operatingSystem;
  84.     /**
  85.      * @ORM\ManyToOne(targetEntity=Pfunctions::class, inversedBy="products")
  86.      * @ORM\JoinColumn(nullable=false)
  87.      */
  88.     private $functions;
  89.     /**
  90.      * @ORM\ManyToOne(targetEntity=Printerseries::class, inversedBy="products")
  91.      * @ORM\JoinColumn(nullable=false)
  92.      */
  93.     private $series;
  94.     /**
  95.      * @ORM\ManyToOne(targetEntity=Ink::class, inversedBy="products")
  96.      * @ORM\JoinColumn(nullable=false)
  97.      */
  98.     private $ink;
  99.     /**
  100.      * @ORM\ManyToOne(targetEntity=Printerspeed::class, inversedBy="products")
  101.      * @ORM\JoinColumn(nullable=false)
  102.      */
  103.     private $speed;
  104.     /**
  105.      * @ORM\ManyToOne(targetEntity=Connection::class, inversedBy="products")
  106.      * @ORM\JoinColumn(nullable=false)
  107.      */
  108.     private $connection;
  109.     /**
  110.      * @ORM\ManyToOne(targetEntity=Papersize::class, inversedBy="products")
  111.      * @ORM\JoinColumn(nullable=false)
  112.      */
  113.     private $size;
  114.     /**
  115.      * @ORM\ManyToOne(targetEntity=Paperstock::class)
  116.      * @ORM\JoinColumn(nullable=false)
  117.      */
  118.     private $stock;
  119.     /**
  120.      * @ORM\ManyToOne(targetEntity=Fieldofuse::class, inversedBy="products")
  121.      * @ORM\JoinColumn(nullable=false)
  122.      */
  123.     private $fieldofuse;
  124.     /**
  125.      * @ORM\ManyToOne(targetEntity=Resolutions::class, inversedBy="products")
  126.      * @ORM\JoinColumn(nullable=false)
  127.      */
  128.     private $resolution;
  129.     /**
  130.      * @ORM\ManyToOne(targetEntity=Duplexprinting::class, inversedBy="products")
  131.      * @ORM\JoinColumn(nullable=false)
  132.      */
  133.     private $duplexprinting;
  134.     /**
  135.      * @ORM\Column(type="datetime_immutable")
  136.      */
  137.     private $createdAt;
  138.     /**
  139.      * @ORM\Column(type="datetime_immutable")
  140.      */
  141.     private $updatedAt;
  142.     /**
  143.      * @ORM\ManyToOne(targetEntity=Category::class, inversedBy="products")
  144.      */
  145.     private $category;
  146.     public function getId(): ?int
  147.     {
  148.         return $this->id;
  149.     }
  150.     public function getName(): ?string
  151.     {
  152.         return $this->name;
  153.     }
  154.     public function setName(string $name): self
  155.     {
  156.         $this->name $name;
  157.         return $this;
  158.     }
  159.     public function getImage(): ?string
  160.     {
  161.         return $this->image;
  162.     }
  163.     public function setImage(string $image): self
  164.     {
  165.         $this->image $image;
  166.         return $this;
  167.     }
  168.     public function getArticlenumber(): ?string
  169.     {
  170.         return $this->articlenumber;
  171.     }
  172.     public function setArticlenumber(string $articlenumber): self
  173.     {
  174.         $this->articlenumber $articlenumber;
  175.         return $this;
  176.     }
  177.     public function getNumberofremaining(): ?string
  178.     {
  179.         return $this->numberofremaining;
  180.     }
  181.     public function setNumberofremaining(string $numberofremaining): self
  182.     {
  183.         $this->numberofremaining $numberofremaining;
  184.         return $this;
  185.     }
  186.     public function getDescription(): ?string
  187.     {
  188.         return $this->description;
  189.     }
  190.     public function setDescription(string $description): self
  191.     {
  192.         $this->description $description;
  193.         return $this;
  194.     }
  195.     public function getPrice(): ?string
  196.     {
  197.         return $this->price;
  198.     }
  199.     public function setPrice(string $price): self
  200.     {
  201.         $this->price $price;
  202.         return $this;
  203.     }
  204.     public function getTimeofdelivery(): ?string
  205.     {
  206.         return $this->timeofdelivery;
  207.     }
  208.     public function setTimeofdelivery(string $timeofdelivery): self
  209.     {
  210.         $this->timeofdelivery $timeofdelivery;
  211.         return $this;
  212.     }
  213.     public function getColour(): ?Colour
  214.     {
  215.         return $this->colour;
  216.     }
  217.     public function setColour(?Colour $colour): self
  218.     {
  219.         $this->colour $colour;
  220.         return $this;
  221.     }
  222.     public function getModel(): ?Model
  223.     {
  224.         return $this->model;
  225.     }
  226.     public function setModel(?Model $model): self
  227.     {
  228.         $this->model $model;
  229.         return $this;
  230.     }
  231.     public function getManufacturer(): ?Manufacturer
  232.     {
  233.         return $this->manufacturer;
  234.     }
  235.     public function setManufacturer(?Manufacturer $manufacturer): self
  236.     {
  237.         $this->manufacturer $manufacturer;
  238.         return $this;
  239.     }
  240.     public function getOperatingSystem(): ?OperatingSystem
  241.     {
  242.         return $this->operatingSystem;
  243.     }
  244.     public function setOperatingSystem(?OperatingSystem $operatingSystem): self
  245.     {
  246.         $this->operatingSystem $operatingSystem;
  247.         return $this;
  248.     }
  249.     public function getFunctions(): ?Pfunctions
  250.     {
  251.         return $this->functions;
  252.     }
  253.     public function setFunctions(?Pfunctions $functions): self
  254.     {
  255.         $this->functions $functions;
  256.         return $this;
  257.     }
  258.     public function getSeries(): ?Printerseries
  259.     {
  260.         return $this->series;
  261.     }
  262.     public function setSeries(?Printerseries $series): self
  263.     {
  264.         $this->series $series;
  265.         return $this;
  266.     }
  267.     public function getInk(): ?Ink
  268.     {
  269.         return $this->ink;
  270.     }
  271.     public function setInk(?Ink $ink): self
  272.     {
  273.         $this->ink $ink;
  274.         return $this;
  275.     }
  276.     public function getSpeed(): ?Printerspeed
  277.     {
  278.         return $this->speed;
  279.     }
  280.     public function setSpeed(?Printerspeed $speed): self
  281.     {
  282.         $this->speed $speed;
  283.         return $this;
  284.     }
  285.     public function getConnection(): ?Connection
  286.     {
  287.         return $this->connection;
  288.     }
  289.     public function setConnection(?Connection $connection): self
  290.     {
  291.         $this->connection $connection;
  292.         return $this;
  293.     }
  294.     public function getSize(): ?Papersize
  295.     {
  296.         return $this->size;
  297.     }
  298.     public function setSize(?Papersize $size): self
  299.     {
  300.         $this->size $size;
  301.         return $this;
  302.     }
  303.     public function getStock(): ?Paperstock
  304.     {
  305.         return $this->stock;
  306.     }
  307.     public function setStock(?Paperstock $stock): self
  308.     {
  309.         $this->stock $stock;
  310.         return $this;
  311.     }
  312.     public function getFieldofuse(): ?Fieldofuse
  313.     {
  314.         return $this->fieldofuse;
  315.     }
  316.     public function setFieldofuse(?Fieldofuse $fieldofuse): self
  317.     {
  318.         $this->fieldofuse $fieldofuse;
  319.         return $this;
  320.     }
  321.     public function getResolution(): ?Resolutions
  322.     {
  323.         return $this->resolution;
  324.     }
  325.     public function setResolution(?Resolutions $resolution): self
  326.     {
  327.         $this->resolution $resolution;
  328.         return $this;
  329.     }
  330.     public function getDuplexprinting(): ?Duplexprinting
  331.     {
  332.         return $this->duplexprinting;
  333.     }
  334.     public function setDuplexprinting(?Duplexprinting $duplexprinting): self
  335.     {
  336.         $this->duplexprinting $duplexprinting;
  337.         return $this;
  338.     }
  339.     public function getCreatedAt(): ?\DateTimeImmutable
  340.     {
  341.         return $this->createdAt;
  342.     }
  343.     public function setCreatedAt(\DateTimeImmutable $createdAt): self
  344.     {
  345.         $this->createdAt $createdAt;
  346.         return $this;
  347.     }
  348.     public function getUpdatedAt(): ?\DateTimeImmutable
  349.     {
  350.         return $this->updatedAt;
  351.     }
  352.     public function setUpdatedAt(\DateTimeImmutable $updatedAt): self
  353.     {
  354.         $this->updatedAt $updatedAt;
  355.         return $this;
  356.     }
  357.     public function getCategory(): ?Category
  358.     {
  359.         return $this->category;
  360.     }
  361.     public function setCategory(?Category $category): self
  362.     {
  363.         $this->category $category;
  364.         return $this;
  365.     }
  366. }