src/Entity/MarketRumorCargo.php line 32

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity;
  4. use ApiPlatform\Core\Annotation\ApiProperty;
  5. use ApiPlatform\Core\Annotation\ApiResource;
  6. use App\Trait\TimestampableEntity;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Serializer\Annotation\Groups;
  9. use Symfony\Component\Serializer\Annotation\MaxDepth;
  10. use Ramsey\Uuid\Uuid;
  11. use Ramsey\Uuid\UuidInterface;
  12. #[ORM\Entity]
  13. #[ApiResource(
  14.     iri'MarketRumorCargo',
  15.     collectionOperations: [],
  16.     itemOperations: [
  17.         'get' => [
  18.             'security' => "is_granted('ROLE_USER')",
  19.             "method" => "GET",
  20.             "path" => "/market_rumors/cargo/{id}",
  21.             "openapi_context" => [
  22.                 "tags" => ["MarketRumor / Cargo"]
  23.             ]
  24.         ]
  25.     ],
  26.     attributes: ["pagination_enabled" => false]
  27. )]
  28. class MarketRumorCargo
  29. {
  30.     use TimestampableEntity;
  31.     #[ORM\Id]
  32.     #[ORM\GeneratedValue(strategy'NONE')]
  33.     #[ORM\Column(type'uuid'uniquetrue)]
  34.     private ?UuidInterface $id null;
  35.     #[ORM\ManyToOne(
  36.         targetEntityCargo::class, 
  37.         inversedBy'marketRumorCargos'
  38.     )]
  39.     #[ORM\JoinColumn(nullabletrue)]
  40.     #[ApiProperty()]
  41.     #[Groups([
  42.         'market_rumor:collection:post'
  43.         'market_rumor:item:get'
  44.         'market_rumor:item:put'
  45.     ])]
  46.     #[MaxDepth(1)]
  47.     private ?Cargo $cargo null;
  48.     #[ORM\Column(type'string'nullabletrue)]
  49.     #[ApiProperty()]
  50.     #[Groups([
  51.         'market_rumor:collection:post'
  52.         'market_rumor:item:get'
  53.         'market_rumor:item:put'
  54.     ])]
  55.     private ?string $quantityM3 null;
  56.     #[ORM\Column(type'string'nullabletrue)]
  57.     #[ApiProperty()]
  58.     #[Groups([
  59.         'market_rumor:collection:post'
  60.         'market_rumor:item:get'
  61.         'market_rumor:item:put'
  62.     ])]
  63.     private ?string $quantityMT null;
  64.     #[ORM\ManyToOne(
  65.         targetEntityMarketRumor::class, 
  66.         inversedBy'cargoItems'
  67.     )]
  68.     #[ORM\JoinColumn(nullabletrue)]
  69.     private ?MarketRumor $marketRumor null;
  70.     public function __construct()
  71.     {
  72.         $this->id Uuid::uuid4();
  73.     }
  74.     public function getId(): ?UuidInterface
  75.     {
  76.         return $this->id;
  77.     }
  78.     public function setCargo(?Cargo $cargo): void
  79.     {
  80.         $this->cargo $cargo;
  81.     }
  82.     public function getCargo(): ?Cargo
  83.     {
  84.         return $this->cargo;
  85.     }
  86.     public function setMarketRumor(?MarketRumor $marketRumor): void
  87.     {
  88.         $this->marketRumor $marketRumor;
  89.     }
  90.     public function getMarketRumor(): ?MarketRumor
  91.     {
  92.         return $this->marketRumor;
  93.     }
  94.     public function getQuantityM3(): ?string
  95.     {
  96.         return $this->quantityM3;
  97.     }
  98.     public function setQuantityM3(?string $quantityM3): void
  99.     {
  100.         $this->quantityM3 $quantityM3;
  101.     }
  102.     public function getQuantityMT(): ?string
  103.     {
  104.         return $this->quantityMT;
  105.     }
  106.     public function setQuantityMT(?string $quantityMT): void
  107.     {
  108.         $this->quantityMT $quantityMT;
  109.     }
  110. }