src/Entity/Reference/ReferenceTransactionRentalType.php line 28

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Reference;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Repository\Reference\ReferenceTransactionRentalTypeRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Serializer\Annotation\Groups;
  7. /**
  8.  * @ApiResource(
  9.  *     security= "is_granted('ROLE_AGENT') or is_granted('ROLE_MANAGER')",
  10.  *     normalizationContext={"groups"={"reference-transaction-rental-type:read"}, "swagger_definition_name"="Read"},
  11.  *     denormalizationContext={"groups"={"reference-transaction-rental-type:write"}, "swagger_definition_name"="Write"},
  12.  *     itemOperations={
  13.  *          "get"
  14.  *     },
  15.  *     collectionOperations={
  16.  *           "get",
  17.  *
  18.  *     },
  19.  *     attributes={
  20.  *          "formats"={"jsonld", "json", "html", "jsonhal", "csv"={"text/csv"} }
  21.  *     }
  22.  * )
  23.  * @ORM\Entity(repositoryClass=ReferenceTransactionRentalTypeRepository::class)
  24.  */
  25. class ReferenceTransactionRentalType
  26. {
  27.     public const TRANSLATION_DOMAIN 'reference_transaction_type';
  28.     public const REFERENCE_TRANSACTION_RENTAL_TYPE_LONG_DURATION 'reference.transaction.rental.type.LONG_DURATION';
  29.     public const REFERENCE_TRANSACTION_RENTAL_TYPE_SHORT_DURATION 'reference.transaction.rental.type.SHORT_DURATION';
  30.     public const REFERENCE_CODE_TRANSACTION_RENTAL_TYPE_LONG_DURATION 'LONG_DURATION';
  31.     public const REFERENCE_CODE_TRANSACTION_RENTAL_TYPE_SHORT_DURATION 'SHORT_DURATION';
  32.     public const ALL_REFERENCE_TRANSACTION_RENTAL_TYPE = [
  33.         self::REFERENCE_TRANSACTION_RENTAL_TYPE_LONG_DURATION,
  34.         self::REFERENCE_TRANSACTION_RENTAL_TYPE_SHORT_DURATION,
  35.     ];
  36.     public const ALL_CODE_TRANSACTION_RENTAL_TYPE = [
  37.         self::REFERENCE_CODE_TRANSACTION_RENTAL_TYPE_LONG_DURATION,
  38.         self::REFERENCE_CODE_TRANSACTION_RENTAL_TYPE_SHORT_DURATION,
  39.     ];
  40.     /**
  41.      * @ORM\Id
  42.      * @ORM\GeneratedValue
  43.      * @ORM\Column(type="integer")
  44.      *
  45.      * @Groups({
  46.      *    "transaction-item:read",
  47.      *    "reference-transaction-rental-type:read"
  48.      * })
  49.      */
  50.     private $id;
  51.     /**
  52.      * @ORM\Column(type="string", length=255)
  53.      *
  54.      * @Groups({
  55.      *    "transaction-item:read",
  56.      *    "reference-transaction-rental-type:read"
  57.      * })
  58.      */
  59.     private ?string $name;
  60.     /**
  61.      * @ORM\Column(type="string", length=255)
  62.      *
  63.      * @Groups({
  64.      *    "transaction-item:read",
  65.      *     "reference-transaction-rental-type:read"
  66.      * })
  67.      */
  68.     private ?string $code;
  69.     public function getId(): ?int
  70.     {
  71.         return $this->id;
  72.     }
  73.     public function getName(): ?string
  74.     {
  75.         return $this->name;
  76.     }
  77.     public function setName(string $name): self
  78.     {
  79.         $this->name $name;
  80.         return $this;
  81.     }
  82.     public function getCode(): ?string
  83.     {
  84.         return $this->code;
  85.     }
  86.     public function setCode(string $code): self
  87.     {
  88.         $this->code $code;
  89.         return $this;
  90.     }
  91. }