src/Entity/Matrix.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiProperty;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use App\Repository\MatrixRepository;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  8. use Symfony\Component\Serializer\Annotation\Groups;
  9. /**
  10.  * @ORM\Entity(repositoryClass=MatrixRepository::class)
  11.  * @ApiResource(
  12.  *     collectionOperations={"get","post"},
  13.  *     itemOperations={"get","put","patch","delete"},
  14.  *     normalizationContext={"groups"={"matrix"}},
  15.  *     denormalizationContext={"groups"={"matrix"}},
  16.  *     attributes={"pagination_enabled"=false}
  17.  * )
  18.  * @UniqueEntity("reference")
  19.  */
  20. class Matrix
  21. {
  22.     /**
  23.      * @ORM\Id
  24.      * @ORM\GeneratedValue
  25.      * @ORM\Column(type="integer")
  26.      * @ApiProperty(identifier=false)
  27.      */
  28.     private $id;
  29.     /**
  30.      * @ORM\Column(type="string")
  31.      * @Groups("matrix")
  32.      */
  33.     private $customerId;
  34.     /**
  35.      * @ORM\Column(type="string", length=60,unique=true)
  36.      * @Groups("matrix")
  37.      * @ApiProperty(identifier=true)
  38.      */
  39.     private $reference;
  40.     /**
  41.      * @ORM\Column(type="string", length=255, nullable=true)
  42.      * @Groups("matrix")
  43.      */
  44.     private $deliveryAddress;
  45.     public function __construct()
  46.     {
  47.     }
  48.     public function getId(): ?int
  49.     {
  50.         return $this->id;
  51.     }
  52.     public function getCustomerId(): ?string
  53.     {
  54.         return $this->customerId;
  55.     }
  56.     public function setCustomerId(string $customerId): self
  57.     {
  58.         $this->customerId $customerId;
  59.         return $this;
  60.     }
  61.     public function getReference(): ?string
  62.     {
  63.         return $this->reference;
  64.     }
  65.     public function setReference(string $reference): self
  66.     {
  67.         $this->reference $reference;
  68.         return $this;
  69.     }
  70.     public function getDeliveryAddress(): ?string
  71.     {
  72.         return $this->deliveryAddress;
  73.     }
  74.     public function setDeliveryAddress(?string $deliveryAddress): self
  75.     {
  76.         $this->deliveryAddress $deliveryAddress;
  77.         return $this;
  78.     }
  79. }