src/Domain/MarginCheckList/Adapters/Gateway/Doctrine/MarginCheckListEntity.php line 28

Open in your IDE?
  1. <?php
  2. namespace App\Domain\MarginCheckList\Adapters\Gateway\Doctrine;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Domain\MarginCheckList\Adapters\Gateway\Doctrine\Repository\DoctrineMarginCheckListRepository;
  5. use App\Entity\AbstractTransaction;
  6. use App\Traits\TimeStampTrait;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Serializer\Annotation\Groups;
  9. /**
  10.  * @ORM\Entity(repositoryClass=DoctrineMarginCheckListRepository::class)
  11.  * @ORM\Table( name="margin_check_list")
  12.  * @ApiResource(
  13.  *     security= "is_granted('ROLE_AGENT') or is_granted('ROLE_MANAGER')",
  14.  *     normalizationContext={"groups"={"margin:read"}, "swagger_definition_name"="Read"},
  15.  *     denormalizationContext={"groups"={"margin:write"}, "swagger_definition_name"="Write"},
  16.  *     itemOperations={
  17.  *          "get"
  18.  *     },
  19.  *     collectionOperations={
  20.  *           "get"
  21.  *     },
  22.  * )
  23.  * @ORM\HasLifecycleCallbacks()
  24.  */
  25. class MarginCheckListEntity
  26. {
  27.     use TimeStampTrait;
  28.     /**
  29.      *
  30.      * @ORM\Id
  31.      * @ORM\GeneratedValue
  32.      * @ORM\Column(type="integer")
  33.      * @Groups({
  34.      *   "transaction-item:read","transaction:collection:read","margin:read"
  35.      * })
  36.      */
  37.     private ?int $id;
  38.     /**
  39.      * @var AbstractTransaction
  40.      *
  41.      * @ORM\OneToOne(targetEntity="App\Entity\AbstractTransaction", inversedBy="marginCheckLists")
  42.      * @ORM\JoinColumn(name="transaction_id", referencedColumnName="id", nullable=false, onDelete="cascade")
  43.      * @Groups({
  44.      *   "margin:read"
  45.      * })
  46.      */
  47.     private $transaction;
  48.     /**
  49.      * @var float
  50.      *
  51.      * @ORM\Column(name="total_commission", type="float", scale=2)
  52.      * @Groups({
  53.      *   "transaction-item:read","transaction:collection:read","margin:read"
  54.      * })
  55.      */
  56.     private float $totalCommission;
  57.     /**
  58.      * @var \DateTimeInterface|null
  59.      *
  60.      * @ORM\Column(type="datetime", nullable=true)
  61.      * @Groups({
  62.      *   "transaction-item:read","transaction:collection:read","margin:read"
  63.      * })
  64.      */
  65.     private ?\DateTimeInterface $paidAt;
  66.     /**
  67.      * @return int|null
  68.      */
  69.     public function getId(): ?int
  70.     {
  71.         return $this->id;
  72.     }
  73.     /**
  74.      * @param int|null $id
  75.      * @return MarginCheckListEntity
  76.      */
  77.     public function setId(?int $id): self
  78.     {
  79.         $this->id $id;
  80.         return $this;
  81.     }
  82.     /**
  83.      * @return AbstractTransaction
  84.      */
  85.     public function getTransaction()
  86.     {
  87.         return $this->transaction;
  88.     }
  89.     /**
  90.      * @param AbstractTransaction $transaction
  91.      * @return MarginCheckListEntity
  92.      */
  93.     public function setTransaction(AbstractTransaction $transaction)
  94.     {
  95.         $this->transaction $transaction;
  96.         return $this;
  97.     }
  98.     /**
  99.      * @return float
  100.      */
  101.     public function getTotalCommission(): float
  102.     {
  103.         return $this->totalCommission;
  104.     }
  105.     /**
  106.      * @param float $totalCommission
  107.      * @return MarginCheckListEntity
  108.      */
  109.     public function setTotalCommission(float $totalCommission): MarginCheckListEntity
  110.     {
  111.         $this->totalCommission $totalCommission;
  112.         return $this;
  113.     }
  114.     /**
  115.      * @return \DateTimeInterface|null
  116.      */
  117.     public function getPaidAt(): ?\DateTimeInterface
  118.     {
  119.         return $this->paidAt;
  120.     }
  121.     /**
  122.      * @param \DateTimeInterface|null $paidAt
  123.      */
  124.     public function setPaidAt(?\DateTimeInterface $paidAt): void
  125.     {
  126.         $this->paidAt $paidAt;
  127.     }
  128. }