src/Entity/Operation/Refund.php line 55

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Operation;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Repository\Operation\RefundRepository;
  5. use Doctrine\Common\Annotations\Annotation\IgnoreAnnotation;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. use ApiPlatform\Core\Annotation\ApiFilter;
  9. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\BooleanFilter;
  10. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\DateFilter;
  11. /**
  12.  * @ORM\Entity(repositoryClass=RefundRepository::class)
  13.  * @ApiResource(
  14.  *     attributes={
  15.  *          "normalization_context"={
  16.  *              "groups"={
  17.  *                  "OperationRefund:output",
  18.  *                  "OperationRefund:io"
  19.  *              }
  20.  *          },
  21.  *          "denormalization_context"={
  22.  *              "groups"={
  23.  *                  "OperationRefund:input",
  24.  *                  "OperationRefund:io"
  25.  *              }
  26.  *          }
  27.  *      },
  28.  *     collectionOperations={
  29.  *          "post"={
  30.  *              "method"="POST",
  31.  *              "access_control"="is_granted('ROLE_ADMIN_SOGEC')",
  32.  *          },
  33.  *          "get"={
  34.  *              "method"="GET",
  35.  *              "access_control"="is_granted('ROLE_USER')",
  36.  *          }
  37.  *     },
  38.  *     itemOperations={
  39.  *          "put"={
  40.  *              "method"="PUT",
  41.  *              "access_control"="is_granted('ROLE_ADMIN_SOGEC')",
  42.  *          },
  43.  *          "get"={
  44.  *              "method"="GET",
  45.  *              "access_control"="is_granted('ROLE_USER')",
  46.  *          },
  47.  *      }
  48.  * )
  49.  *
  50.  */
  51. class Refund extends Operation
  52. {
  53.     /**
  54.      * @ORM\Column(type="datetime", options={"default": "CURRENT_TIMESTAMP"})
  55.      * @Groups({
  56.      *     "OperationRefund:io"
  57.      * })
  58.      * @ApiFilter(DateFilter::class, strategy=DateFilter::EXCLUDE_NULL)
  59.      */
  60.     private $startDate;
  61.     /**
  62.      * @ORM\Column(type="datetime", options={"default": "CURRENT_TIMESTAMP"})
  63.      * @Groups({
  64.      *     "OperationRefund:io"
  65.      * })
  66.      * @ApiFilter(DateFilter::class, strategy=DateFilter::EXCLUDE_NULL)
  67.      */
  68.     private $endDate;
  69.     /**
  70.      * @ORM\Column(type="boolean", options={"default": 1})
  71.      * @Groups({
  72.      *     "OperationRefund:io"
  73.      * })
  74.      * @ApiFilter(BooleanFilter::class)
  75.      */
  76.     private bool $online false;
  77.     public function getStartDate(): ?\DateTimeInterface
  78.     {
  79.         return $this->startDate;
  80.     }
  81.     public function setStartDate(\DateTimeInterface $startDate): self
  82.     {
  83.         $this->startDate $startDate;
  84.         return $this;
  85.     }
  86.     public function getEndDate(): ?\DateTimeInterface
  87.     {
  88.         return $this->endDate;
  89.     }
  90.     public function setEndDate(\DateTimeInterface $endDate): self
  91.     {
  92.         $this->endDate $endDate;
  93.         return $this;
  94.     }
  95.     public function isOnline(): bool
  96.     {
  97.         return (bool)$this->online;
  98.     }
  99.     public function getOnline(): bool
  100.     {
  101.         return (bool)$this->online;
  102.     }
  103.     public function setOnline(bool $online): self
  104.     {
  105.         $this->online $online;
  106.         return $this;
  107.     }
  108. }