src/Entity/Pointing.php line 21

  1. <?php
  2. namespace App\Entity;
  3. use DateTime;
  4. use App\Entity\Timestamps;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use App\Repository\PointingRepository;
  7. use ApiPlatform\Core\Annotation\ApiResource;
  8. use Symfony\Component\Serializer\Annotation\Groups;
  9. use Symfony\Bridge\Doctrine\IdGenerator\UlidGenerator;
  10. use Symfony\Component\Uid\Ulid;
  11. use Gedmo\Mapping\Annotation as Gedmo;
  12. #[ORM\Entity(repositoryClassPointingRepository::class)]
  13. #[Gedmo\SoftDeleteable(fieldName'deletedAt'timeAwarefalsehardDeletetrue)]
  14. #[ORM\HasLifecycleCallbacks]
  15. #[ApiResource(
  16.     attributes: ["security" => "is_granted('IS_AUTHENTICATED_FULLY')"],
  17. )]
  18. class Pointing
  19. {
  20.     use Timestamps;
  21.     #[ORM\Id]
  22.     #[ORM\Column(type'ulid'uniquetrue)]
  23.     #[ORM\GeneratedValue(strategy"CUSTOM")]
  24.     #[ORM\CustomIdGenerator(class: UlidGenerator::class)]
  25.     #[Groups(['read:pointing:basic'])]
  26.     private ?Ulid $id null;
  27.     #[ORM\ManyToOne(targetEntityChild::class, inversedBy'pointings')]
  28.     #[ORM\JoinColumn(nullablefalse)]
  29.     private $child;
  30.     #[ORM\Column(type'time'nullabletrue)]
  31.     #[Groups(['read:pointing:basic'])]
  32.     private $check_in;
  33.     #[ORM\Column(type'time'nullabletrue)]
  34.     #[Groups(['read:pointing:basic'])]
  35.     private $check_out;
  36.     #[ORM\ManyToOne(targetEntityUser::class, inversedBy'pointings')]
  37.     #[ORM\JoinColumn(nullablefalse)]
  38.     private $created_by;
  39.     #[ORM\ManyToOne(targetEntityCompany::class, inversedBy'pointings')]
  40.     #[ORM\JoinColumn(nullablefalse)]
  41.     private $owner;
  42.     #[ORM\ManyToOne(targetEntitySeason::class, inversedBy'pointings')]
  43.     #[ORM\JoinColumn(nullablefalse)]
  44.     private $season;
  45.     #[ORM\Column(type'string'length255nullabletrue)]
  46.     #[Groups(['read:pointing:basic'])]
  47.     private $description;
  48.     #[ORM\Column(type'datetime')]
  49.     #[Groups(['read:pointing:basic'])]
  50.     private $date;
  51.     public function __construct()
  52.     {
  53.         $this->date = new DateTime();
  54.     }
  55.     public function getId(): ?Ulid
  56.     {
  57.         return $this->id;
  58.     }
  59.     public function getChild(): ?Child
  60.     {
  61.         return $this->child;
  62.     }
  63.     public function setChild(?Child $child): self
  64.     {
  65.         $this->child $child;
  66.         return $this;
  67.     }
  68.     public function getCheckIn(): ?\DateTimeInterface
  69.     {
  70.         return $this->check_in;
  71.     }
  72.     public function setCheckIn(\DateTimeInterface $check_in): self
  73.     {
  74.         $this->check_in $check_in;
  75.         return $this;
  76.     }
  77.     public function getCheckOut(): ?\DateTimeInterface
  78.     {
  79.         return $this->check_out;
  80.     }
  81.     public function setCheckOut(\DateTimeInterface $check_out): self
  82.     {
  83.         $this->check_out $check_out;
  84.         return $this;
  85.     }
  86.     public function getCreatedBy(): ?User
  87.     {
  88.         return $this->created_by;
  89.     }
  90.     public function setCreatedBy(?User $created_by): self
  91.     {
  92.         $this->created_by $created_by;
  93.         return $this;
  94.     }
  95.     public function getOwner(): ?Company
  96.     {
  97.         return $this->owner;
  98.     }
  99.     public function setOwner(?Company $owner): self
  100.     {
  101.         $this->owner $owner;
  102.         return $this;
  103.     }
  104.     public function getSeason(): ?Season
  105.     {
  106.         return $this->season;
  107.     }
  108.     public function setSeason(?Season $season): self
  109.     {
  110.         $this->season $season;
  111.         return $this;
  112.     }
  113.     public function getDescription(): ?string
  114.     {
  115.         return $this->description;
  116.     }
  117.     public function setDescription(?string $description): self
  118.     {
  119.         $this->description $description;
  120.         return $this;
  121.     }
  122.     public function getDate(): ?\DateTimeInterface
  123.     {
  124.         return $this->date;
  125.     }
  126.     public function setDate(\DateTimeInterface $date): self
  127.     {
  128.         $this->date $date;
  129.         return $this;
  130.     }
  131. }