src/Point/Doctrine/Entity/Purchase.php line 23

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Point\Doctrine\Entity;
  4. use ApiPlatform\Core\Annotation\ApiProperty;
  5. use ApiPlatform\Core\Annotation\ApiResource;
  6. use App\Point\Doctrine\Repository\PurchaseRepository;
  7. use Doctrine\ORM\Mapping\Column;
  8. use Doctrine\ORM\Mapping\Entity;
  9. use Doctrine\ORM\Mapping\ManyToOne;
  10. use Symfony\Component\Serializer\Annotation\Groups;
  11. use Symfony\Component\Validator\Constraints\NotNull;
  12. #[ApiResource(
  13.     collectionOperations: ['get''post'],
  14.     itemOperations: ['get' => ['security' => 'is_granted("item", object)']],
  15.     normalizationContext: ['groups' => ['read']],
  16.     denormalizationContext: ['groups' => ['write']]
  17. )]
  18. #[Entity(repositoryClassPurchaseRepository::class)]
  19. class Purchase extends Transaction
  20. {
  21.     #[ManyToOne(targetEntityPaymentMethod::class)]
  22.     #[Groups(['read''write'])]
  23.     #[ApiProperty(readableLinkfalsewritableLinkfalse)]
  24.     private ?PaymentMethod $paymentMethod null;
  25.     #[Column]
  26.     #[Groups('read')]
  27.     private string $state 'pending';
  28.     #[Column(nullabletrue)]
  29.     #[Groups(['read''write'])]
  30.     private ?string $internReference null;
  31.     public function getPaymentMethod(): ?PaymentMethod
  32.     {
  33.         return $this->paymentMethod;
  34.     }
  35.     public function setPaymentMethod(?PaymentMethod $paymentMethod): void
  36.     {
  37.         $this->paymentMethod $paymentMethod;
  38.     }
  39.     public function getState(): string
  40.     {
  41.         return $this->state;
  42.     }
  43.     public function setState(string $state): void
  44.     {
  45.         $this->state $state;
  46.     }
  47.     public function getInternReference(): ?string
  48.     {
  49.         return $this->internReference;
  50.     }
  51.     public function setInternReference(?string $internReference): void
  52.     {
  53.         $this->internReference $internReference;
  54.     }
  55. }