<?php
namespace App\Entity;
use App\Repository\CourseAutoEnrollmentRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
#[ORM\Entity(repositoryClass: CourseAutoEnrollmentRepository::class)]
class CourseAutoEnrollment
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
#[Groups(['LogService'])]
private $id;
#[ORM\ManyToOne(targetEntity: Course::class, inversedBy: 'courseAutoEnrollments')]
#[Groups(['LogService'])]
private $course;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $status;
#[ORM\ManyToMany(targetEntity: Department::class, inversedBy: 'courseAutoEnrollments')]
private $departments;
#[ORM\JoinTable(name: 'office_course_auto_enrollment')]
#[ORM\JoinColumn(name: 'course_auto_enrollment_id', referencedColumnName: 'id')]
#[ORM\InverseJoinColumn(name: 'office_id', referencedColumnName: 'id')]
#[ORM\ManyToMany(targetEntity: Office::class, inversedBy: 'courseAutoEnrollments')]
private $offices;
#[ORM\Column(type: 'string', length: 255)]
#[Groups(['LogService'])]
private $courseType;
#[ORM\Column(type: 'integer', nullable: true)]
#[Groups(['LogService'])]
private $enrolledDays;
#[ORM\Column(type: 'datetime_immutable')]
private $createdAt;
#[ORM\ManyToOne(targetEntity: User::class)]
private $createdBy;
#[ORM\Column(type: 'datetime_immutable', nullable: true)]
private $updatedAt;
#[ORM\ManyToOne(targetEntity: User::class)]
private $updatedBy;
public function __construct()
{
$this->departments = new ArrayCollection();
$this->offices = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getCourse(): ?Course
{
return $this->course;
}
public function setCourse(?Course $course): self
{
$this->course = $course;
return $this;
}
public function getStatus(): ?string
{
return $this->status;
}
public function setStatus(?string $status): self
{
$this->status = $status;
return $this;
}
/**
* @return Collection|Department[]
*/
public function getDepartments(): Collection
{
return $this->departments;
}
public function addDepartment(Department $department): self
{
if (!$this->departments->contains($department)) {
$this->departments[] = $department;
}
return $this;
}
public function removeDepartment(Department $department): self
{
$this->departments->removeElement($department);
return $this;
}
/**
* @return Collection|Office[]
*/
public function getOffices(): Collection
{
return $this->offices;
}
public function addOffice(Office $office): self
{
if (!$this->offices->contains($office)) {
$this->offices[] = $office;
}
return $this;
}
public function removeOffice(Office $office): self
{
$this->offices->removeElement($office);
return $this;
}
public function getCourseType(): ?string
{
return $this->courseType;
}
public function setCourseType(string $courseType): self
{
$this->courseType = $courseType;
return $this;
}
public function getEnrolledDays(): ?int
{
return $this->enrolledDays;
}
public function setEnrolledDays(?int $enrolledDays): self
{
$this->enrolledDays = $enrolledDays;
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeImmutable $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getCreatedBy(): ?User
{
return $this->createdBy;
}
public function setCreatedBy(?User $createdBy): self
{
$this->createdBy = $createdBy;
return $this;
}
public function getUpdatedAt(): ?\DateTimeImmutable
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeImmutable $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getUpdatedBy(): ?User
{
return $this->updatedBy;
}
public function setUpdatedBy(?User $updatedBy): self
{
$this->updatedBy = $updatedBy;
return $this;
}
}