src/Entity/UserCreditPoint.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use App\Repository\UserCreditPointRepository;
  6. use Symfony\Component\Serializer\Annotation\Groups;
  7. /**
  8.  * @ApiResource(
  9.  *      attributes={"security"="is_granted('IS_AUTHENTICATED_FULLY')"},
  10.  *      normalizationContext={"groups"={"UserCreditPoint:Read"}, "skip_null_values"=false},
  11.  *      denormalizationContext={"groups"={"UserCreditPoint:Write"}},
  12.  *      itemOperations={
  13.  *          "get"
  14.  *     }
  15.  * )
  16.  * @ORM\Entity(repositoryClass=UserCreditPointRepository::class)
  17.  */
  18. class UserCreditPoint
  19. {
  20.     /**
  21.      * @ORM\Id
  22.      * @ORM\GeneratedValue
  23.      * @ORM\Column(type="integer")
  24.      */
  25.     private $id;
  26.     /**
  27.      * @ORM\Column(type="decimal", precision=5, scale=2)
  28.      * @Groups({"Certificate:Read"})
  29.      */
  30.     private $creditPoint;
  31.     /**
  32.      * @ORM\ManyToOne(targetEntity=CreditCategory::class)
  33.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  34.      * @Groups({"Certificate:Read"})
  35.      */
  36.     private $creditCategory;
  37.     /**
  38.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="userCreditPoints")
  39.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  40.      */
  41.     private $user;
  42.     /**
  43.      * @ORM\ManyToOne(targetEntity=Certificate::class, inversedBy="userCreditPoints")
  44.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  45.      */
  46.     private $certificate;
  47.     public function getId(): ?int
  48.     {
  49.         return $this->id;
  50.     }
  51.     public function getCreditPoint(): ?string
  52.     {
  53.         return $this->creditPoint;
  54.     }
  55.     public function setCreditPoint(string $creditPoint): self
  56.     {
  57.         $this->creditPoint $creditPoint;
  58.         return $this;
  59.     }
  60.     public function getCreditCategory(): ?CreditCategory
  61.     {
  62.         return $this->creditCategory;
  63.     }
  64.     public function setCreditCategory(?CreditCategory $creditCategory): self
  65.     {
  66.         $this->creditCategory $creditCategory;
  67.         return $this;
  68.     }
  69.     public function getUser(): ?User
  70.     {
  71.         return $this->user;
  72.     }
  73.     public function setUser(?User $user): self
  74.     {
  75.         $this->user $user;
  76.         return $this;
  77.     }
  78.     public function getCertificate(): ?Certificate
  79.     {
  80.         return $this->certificate;
  81.     }
  82.     public function setCertificate(?Certificate $certificate): self
  83.     {
  84.         $this->certificate $certificate;
  85.         return $this;
  86.     }
  87. }