src/Entity/ElCourseJoin.php line 51

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use App\Filter\ElCourseJoinFilter;
  5. use ApiPlatform\Core\Annotation\ApiFilter;
  6. use App\Repository\ElCourseJoinRepository;
  7. use ApiPlatform\Core\Annotation\ApiResource;
  8. use App\Entity\Interfaces\ContainerMappedInterface;
  9. use Symfony\Component\Serializer\Annotation\Groups;
  10. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\DateFilter;
  11. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter;
  12. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\RangeFilter;
  13. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
  14. /**
  15.  * @ApiResource(
  16.  *      collectionOperations={
  17.  *          "get"={
  18.  *              "security"="is_granted('ROLE_OPERATOR')",
  19.  *              "normalization_context"={"groups"={"ElCourseJoin:Read"}, "skip_null_values"=false}
  20.  *          },
  21.  *          "get_my"={
  22.  *              "path"="/el_course_joins/get-my",
  23.  *              "method"="GET",
  24.  *              "security"="is_granted('IS_AUTHENTICATED_FULLY')",
  25.  *              "normalization_context"={"groups"={"ElCourseJoin:Read"}, "skip_null_values"=false}
  26.  *          },
  27.  *          "post_join_course"={
  28.  *              "route_name"="api_el_course_join_join_course",
  29.  *              "method"="POST",
  30.  *              "security"="is_granted('IS_AUTHENTICATED_FULLY')",
  31.  *              "denormalization_context"={"groups"={"ElCourseJoin:Join-Course"}}
  32.  *          }
  33.  *      },
  34.  *      itemOperations={
  35.  *          "get"={
  36.  *              "security"="is_granted('IS_CO_ANY_SPE', object)",
  37.  *              "normalization_context"={"groups"={"ElCourseJoin:Read"}, "skip_null_values"=false}
  38.  *          }
  39.  *     }
  40.  * )
  41.  * @ApiFilter(SearchFilter::class, properties={"id": "exact", "container.id": "exact", "elCourse.id": "exact", "user.id": "exact"})
  42.  * @ApiFilter(DateFilter::class, properties={"joinDate"})
  43.  * @ApiFilter(ElCourseJoinFilter::class, properties={"search": "partial"})
  44.  * @ApiFilter(OrderFilter::class, properties={"id", "joinDate"})
  45.  * @ApiFilter(RangeFilter::class, properties={"progress"})
  46.  * @ORM\Entity(repositoryClass=ElCourseJoinRepository::class)
  47.  */
  48. class ElCourseJoin implements ContainerMappedInterface
  49. {
  50.     /**
  51.      * @ORM\Id
  52.      * @ORM\GeneratedValue
  53.      * @ORM\Column(type="integer")
  54.      * @Groups({"ElCourseJoin:Read", "User:Me"})
  55.      */
  56.     private $id;
  57.     /**
  58.      * @ORM\Column(type="datetime")
  59.      * @Groups({"ElCourseJoin:Read", "User:Me"})
  60.      */
  61.     private $joinDate;
  62.     /**
  63.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="elCourseJoins")
  64.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  65.      * @Groups({"ElCourseJoin:Read"})
  66.      */
  67.     private $user;
  68.     /**
  69.      * @ORM\ManyToOne(targetEntity=ElCourse::class, inversedBy="elCourseJoins")
  70.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  71.      * @Groups({"ElCourseJoin:Read", "ElCourseJoin:Join-Course", "User:Me"})
  72.      */
  73.     private $elCourse;
  74.     /**
  75.      * @ORM\ManyToOne(targetEntity=Container::class)
  76.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  77.      * @Groups({"ElCourseJoin:Join-Course"})
  78.      */
  79.     private $container;
  80.     /**
  81.      * @ORM\Column(type="integer", nullable=true)
  82.      * @Groups({"ElCourseJoin:Read", "User:Me"})
  83.      */
  84.     private $progress;
  85.     /**
  86.      * @ORM\Column(type="string", length=32, nullable=true)
  87.      * @Groups({"ElCourseJoin:Read", "User:Me"})
  88.      */
  89.     private $lastStarted;
  90.     /**
  91.      * @ORM\Column(type="string", length=32, nullable=true)
  92.      * @Groups({"ElCourseJoin:Read", "User:Me"})
  93.      */
  94.     private $lastEnded;
  95.     /**
  96.      * @ORM\Column(type="integer", nullable=true)
  97.      * @Groups({"ElCourseJoin:Read", "User:Me"})
  98.      */
  99.     private $lastStartedElLessionTopicId;
  100.     /**
  101.      * @ORM\Column(type="integer", nullable=true)
  102.      * @Groups({"ElCourseJoin:Read", "User:Me"})
  103.      */
  104.     private $lastStartedElLessionId;
  105.     public function getId(): ?int
  106.     {
  107.         return $this->id;
  108.     }
  109.     public function getJoinDate(): ?\DateTimeInterface
  110.     {
  111.         return $this->joinDate;
  112.     }
  113.     public function setJoinDate(\DateTimeInterface $joinDate): self
  114.     {
  115.         $this->joinDate $joinDate;
  116.         return $this;
  117.     }
  118.     public function getUser(): ?User
  119.     {
  120.         return $this->user;
  121.     }
  122.     public function setUser(?User $user): self
  123.     {
  124.         $this->user $user;
  125.         return $this;
  126.     }
  127.     public function getElCourse(): ?ElCourse
  128.     {
  129.         return $this->elCourse;
  130.     }
  131.     public function setElCourse(?ElCourse $elCourse): self
  132.     {
  133.         $this->elCourse $elCourse;
  134.         return $this;
  135.     }
  136.     public function getContainer(): ?Container
  137.     {
  138.         return $this->container;
  139.     }
  140.     public function setContainer(?Container $container): self
  141.     {
  142.         $this->container $container;
  143.         return $this;
  144.     }
  145.     public function getProgress(): ?int
  146.     {
  147.         return $this->progress;
  148.     }
  149.     public function setProgress(?int $progress): self
  150.     {
  151.         $this->progress $progress;
  152.         return $this;
  153.     }
  154.     public function getLastStarted(): ?string
  155.     {
  156.         return $this->lastStarted;
  157.     }
  158.     public function setLastStarted(?string $lastStarted): self
  159.     {
  160.         $this->lastStarted $lastStarted;
  161.         return $this;
  162.     }
  163.     public function getLastEnded(): ?string
  164.     {
  165.         return $this->lastEnded;
  166.     }
  167.     public function setLastEnded(?string $lastEnded): self
  168.     {
  169.         $this->lastEnded $lastEnded;
  170.         return $this;
  171.     }
  172.     public function getLastStartedElLessionTopicId(): ?int
  173.     {
  174.         return $this->lastStartedElLessionTopicId;
  175.     }
  176.     public function setLastStartedElLessionTopicId(?int $lastStartedElLessionTopicId): self
  177.     {
  178.         $this->lastStartedElLessionTopicId $lastStartedElLessionTopicId;
  179.         return $this;
  180.     }
  181.     public function getLastStartedElLessionId(): ?int
  182.     {
  183.         return $this->lastStartedElLessionId;
  184.     }
  185.     public function setLastStartedElLessionId(?int $lastStartedElLessionId): self
  186.     {
  187.         $this->lastStartedElLessionId $lastStartedElLessionId;
  188.         return $this;
  189.     }
  190. }